/* =====================================================================
   星露小鎮：希望之光（RPG 版）— style.css
   版面：左上角色狀態、右上小地圖與選單、底部快捷列、手機搖桿與動作鍵、
         通用視窗（角色/背包/技能/任務/寵物/副本/圖鑑/系統/商店/鐵匠…）、開始畫面
   ===================================================================== */

:root {
  --ink: #4e342e;
  --ink2: #6d4c41;
  --paper: rgba(255, 250, 240, .9);
  --paper2: #fff8e1;
  --line: #a1887f;
  --hp1: #ff8a80; --hp2: #e53935;
  --mp1: #82b1ff; --mp2: #2962ff;
  --ex1: #ffe082; --ex2: #ffa000;
  /* 裝備品質：白 → 綠 → 藍 → 紫 → 金 */
  --q0: #9e9e9e; --q0b: #f5f5f5;
  --q1: #43a047; --q1b: #e8f5e9;
  --q2: #1e88e5; --q2b: #e3f2fd;
  --q3: #8e24aa; --q3b: #f3e5f5;
  --q4: #ff8f00; --q4b: #fff8e1; --q5: #e53935; --q5b: #ffebee;
  --safe-t: max(10px, env(safe-area-inset-top));
  --safe-b: max(12px, env(safe-area-inset-bottom));
  --safe-l: max(10px, env(safe-area-inset-left));
  --safe-r: max(10px, env(safe-area-inset-right));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #3e6b2a; font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif; color: var(--ink); overscroll-behavior: none; }
button { font-family: inherit; color: inherit; }
canvas#game { display: block; position: fixed; inset: 0; touch-action: none; }
.hidden { display: none !important; }
kbd { font-family: inherit; }

/* 圖片圖示（game.js 產生的 <img class="ii">） */
.ii { width: 1.2em; height: 1.2em; object-fit: contain; vertical-align: -.25em; pointer-events: none; }
.ic-coin, .ic-gem { display: inline-block; width: 18px; height: 18px; background: center/contain no-repeat; vertical-align: -3px; }
.ic-coin { background-image: url(../art/items/item-coin.webp); }
.ic-gem { background-image: url(../art/items/item-stone.webp); }

/* =====================================================================
   左上：角色狀態 HUD
   ===================================================================== */
#hud {
  position: fixed; top: var(--safe-t); left: var(--safe-l); width: 252px; z-index: 3;
  padding: 9px 11px 10px; background: var(--paper); border: 3px solid #fff; border-radius: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2); transform-origin: top left;
}
.hud-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.avatar {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 3px solid #fff; overflow: hidden; cursor: pointer;
  background: #ffe0b2; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); display: grid; place-items: center; font-size: 24px; position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; transform: scale(1.5); transform-origin: 50% 15%; }
.hud-id { min-width: 0; flex: 1; }
.hname { font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.hname .lv { font-size: 11px; background: var(--ink2); color: #fff; border-radius: 8px; padding: 0 6px; }
.hname .lv b { font-size: 13px; }
.hclass { font-size: 11px; font-weight: 800; opacity: .75; }

.bar { position: relative; height: 16px; border-radius: 9px; background: #e3d7cb; overflow: hidden; margin: 3px 0; border: 2px solid #fff; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 9px; transition: width .15s; }
.bar.hp .fill { background: linear-gradient(var(--hp1), var(--hp2)); }
.bar.hp .fill.sh { background: linear-gradient(rgba(255, 245, 157, .95), rgba(251, 192, 45, .9)); }
.bar.mp .fill { background: linear-gradient(var(--mp1), var(--mp2)); }
.bar.exp { height: 11px; }
.bar.exp .fill { background: linear-gradient(var(--ex1), var(--ex2)); }
.bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .75); }
.bar.exp span { font-size: 9px; }
.bar.hp.low { animation: lowhp .6s infinite alternate; }
@keyframes lowhp { to { box-shadow: 0 0 0 2px #ff5252, inset 0 1px 3px rgba(0, 0, 0, .25); } }

.money { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-weight: 900; font-size: 14px; }
.money span { display: flex; align-items: center; gap: 4px; }
.money .pts { margin-left: auto; font-size: 11px; color: #fff; background: linear-gradient(#ff8a65, #f4511e); border-radius: 10px; padding: 1px 8px; cursor: pointer; animation: pulse 1s infinite; }
.buffs { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.buff { font-size: 10.5px; background: #fff; border-radius: 8px; padding: 1px 6px; font-weight: 800; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); white-space: nowrap; }
.buff.bad { background: #ffebee; color: #c62828; }
.track { margin-top: 6px; font-size: 11.5px; font-weight: 800; background: var(--paper2); border: 2px dashed #ffb74d; border-radius: 10px; padding: 4px 8px; line-height: 1.5; cursor: pointer; }
.track.done { border-color: #66bb6a; background: #e8f5e9; }
.track .tl { display: flex; justify-content: space-between; gap: 6px; }
.track .tl b { white-space: nowrap; }

/* =====================================================================
   右上：小地圖 + 功能選單
   ===================================================================== */
#topRight { position: fixed; top: var(--safe-t); right: var(--safe-r); z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; transform-origin: top right; }
.mapbox { background: var(--paper); border: 3px solid #fff; border-radius: 16px; padding: 5px 6px 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); text-align: center; }
.mapname { font-size: 12.5px; font-weight: 900; }
#minimap { display: block; width: 150px; height: 110px; border-radius: 10px; background: #6d9a4a; margin: 3px 0 2px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.maplv { font-size: 10.5px; font-weight: 800; opacity: .75; }
.maplv.danger { color: #d32f2f; opacity: 1; }
.menu { display: grid; grid-template-columns: repeat(5, 42px); gap: 5px; }
.menu button {
  position: relative; height: 42px; border-radius: 12px; border: 2px solid #fff; background: var(--paper); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.menu button i { font-style: normal; font-size: 18px; }
.menu button span { font-size: 9.5px; font-weight: 900; margin-top: 2px; }
.menu button kbd { position: absolute; top: -4px; right: -4px; font-size: 8.5px; font-weight: 900; background: var(--ink2); color: #fff; border-radius: 6px; padding: 0 3px; }
.menu button.dot::after { content: ''; position: absolute; top: 3px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: #ff5252; box-shadow: 0 0 0 2px #fff; }
.menu button:active { transform: scale(.92); }

/* =====================================================================
   副本資訊 / Boss 血條
   ===================================================================== */
#dungeonHud {
  position: fixed; top: var(--safe-t); left: 50%; transform: translateX(-50%); z-index: 3; text-align: center;
  background: rgba(40, 20, 60, .82); color: #fff; border: 2px solid rgba(255, 255, 255, .8); border-radius: 14px; padding: 4px 12px 6px; min-width: 200px;
}
.dg-name { font-weight: 900; font-size: 13px; color: #e1bee7; }
.dg-info { display: flex; gap: 12px; justify-content: center; font-weight: 800; font-size: 12px; }
#dgTimer { font-variant-numeric: tabular-nums; color: #fff59d; }
#dgTimer.hurry { color: #ff5252; animation: pulse .5s infinite; }
.dg-leave { margin-top: 4px; font-size: 11px; font-weight: 900; border: 2px solid #fff; border-radius: 10px; background: #8e24aa; color: #fff; padding: 1px 10px; cursor: pointer; }
#bossBar { position: fixed; top: calc(var(--safe-t) + 62px); left: 50%; transform: translateX(-50%); width: min(440px, 56vw); text-align: center; pointer-events: none; z-index: 3; }
#bossBar .bn { font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 2px 0 #4a148c, 0 3px 8px rgba(0, 0, 0, .6); }
#bossBar .bb { position: relative; height: 18px; border-radius: 10px; background: rgba(30, 10, 40, .75); border: 2px solid #fff; overflow: hidden; margin-top: 3px; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
#bossBar .bb i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#ce93d8, #7b1fa2); transition: width .15s; }
#bossBar.rage .bb i { background: linear-gradient(#ff8a80, #d50000); }
#bossBar .bb span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }

/* =====================================================================
   底部中央：快捷列（技能冷卻轉圈 + 藥水數量 + 自動喝水）
   ===================================================================== */
#quickBar { position: fixed; bottom: var(--safe-b); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; z-index: 3; touch-action: none; }
.qgroup { display: flex; gap: 6px; padding: 6px; background: rgba(255, 250, 240, .55); border: 2px solid rgba(255, 255, 255, .8); border-radius: 18px; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.qs, .qi, .autopot {
  position: relative; width: 56px; height: 56px; border-radius: 14px; border: 3px solid #fff; background: var(--paper);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .2); cursor: pointer; overflow: hidden; display: grid; place-items: center; font-size: 26px; touch-action: none;
}
.qs.atk { width: 62px; height: 62px; background: #fff3e0; }
.qs .ico, .qi .ico { pointer-events: none; line-height: 1; margin-top: -6px; display: grid; place-items: center; }
.qs .ico .ii, .qi .ico .ii { width: 36px; height: 36px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.qs kbd, .qi kbd { position: absolute; top: 1px; left: 4px; font-size: 9.5px; font-weight: 900; opacity: .7; pointer-events: none; }
.qs .nm { position: absolute; bottom: 2px; left: 0; right: 0; font-size: 9.5px; font-weight: 900; text-align: center; white-space: nowrap; pointer-events: none; }
.qi .cnt { position: absolute; right: 4px; bottom: 1px; font-size: 12px; font-weight: 900; color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; }
.qi.empty .ico { opacity: .35; filter: grayscale(1); }
.qs.locked { filter: grayscale(1); opacity: .55; }
.qs.nomp .ico { filter: grayscale(1) brightness(.9); opacity: .6; }
.qs.ready { animation: ready 1s infinite; }
@keyframes ready { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 235, 59, .9); } 50% { box-shadow: 0 0 0 7px rgba(255, 235, 59, 0); } }
.qs:active, .qi:active, .tb:active { transform: scale(.92); }
/* 冷卻轉圈：game.js 設定 --cd（0~1，剩餘比例） */
.cdm { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; --cd: 0; background: conic-gradient(rgba(30, 20, 15, .58) calc(var(--cd) * 360deg), transparent 0); }
.cdt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.autopot { width: 50px; font-size: 18px; line-height: 1.05; background: #eceff1; }
.autopot i { font-style: normal; display: block; margin-top: -4px; }
.autopot span { font-size: 9.5px; font-weight: 900; text-align: center; }
.autopot.on { background: linear-gradient(#c8e6c9, #81c784); }
.autopot.on b { color: #1b5e20; }

/* =====================================================================
   手機：虛擬搖桿（左下）＋ 動作鍵（右下）
   ===================================================================== */
#touchUI { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#joyZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 58%; pointer-events: auto; touch-action: none; }
#joyBase { position: absolute; left: max(26px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; background: rgba(255, 255, 255, .2); border: 3px solid rgba(255, 255, 255, .55); box-shadow: inset 0 0 20px rgba(255, 255, 255, .25); }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55)); box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
#actionPad { position: absolute; right: var(--safe-r); bottom: var(--safe-b); width: 236px; height: 226px; pointer-events: auto; touch-action: none; }
.tb {
  position: absolute; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .32);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; overflow: hidden; touch-action: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.tb .ico { pointer-events: none; display: grid; place-items: center; font-size: 26px; }
.tb .ico .ii { width: 34px; height: 34px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.tb.atk { width: 92px; height: 92px; right: 0; bottom: 0; }
.tb.atk .ico .ii { width: 52px; height: 52px; }
.tb.sk { width: 58px; height: 58px; }
.tb.s0 { right: 104px; bottom: 0; }
.tb.s1 { right: 92px; bottom: 74px; }
.tb.s2 { right: 34px; bottom: 112px; }
.tb.s3 { right: 156px; bottom: 60px; }
.tb.pot { width: 48px; height: 48px; right: 168px; bottom: 132px; }
.tb.pot .ico .ii { width: 28px; height: 28px; }
.tb .cnt { position: absolute; bottom: 2px; right: 8px; font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none; }
.tb.locked { opacity: .35; }
.tb .cdt { font-size: 15px; }
#interactBtn {
  position: fixed; z-index: 3; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%);
  font-weight: 900; font-size: 14px; border: 3px solid #fff; border-radius: 20px; padding: 6px 16px; background: linear-gradient(#fff59d, #ffca28);
  box-shadow: 0 3px 0 #c49000, 0 6px 14px rgba(0, 0, 0, .25); cursor: pointer; animation: bob 1.2s ease-in-out infinite; white-space: nowrap;
}
#interactBtn kbd { font-size: 10px; margin-left: 6px; opacity: .6; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }

/* 觸控模式：隱藏電腦快捷列、改顯示搖桿 */
body.touch #quickBar { display: none !important; }
body.touch #interactBtn { bottom: calc(var(--safe-b) + 6px); }
body.touch #interactBtn kbd { display: none; }
body:not(.touch) #touchUI { display: none !important; }

/* =====================================================================
   訊息：地圖標題、提示、戰鬥紀錄、淡入淡出
   ===================================================================== */
#sceneTitle { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); font-size: 32px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 #8d6e63, 0 6px 14px rgba(0, 0, 0, .4); opacity: 0; transition: opacity .5s; pointer-events: none; text-align: center; white-space: nowrap; z-index: 4; }
#sceneTitle small { display: block; font-size: 15px; margin-top: 4px; }
#toast { position: fixed; top: calc(var(--safe-t) + 4px); left: 50%; transform: translateX(-50%); background: rgba(93, 64, 55, .9); color: #fff; font-weight: 800; padding: 8px 18px; border-radius: 20px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; z-index: 9; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#logBox { position: fixed; left: var(--safe-l); bottom: calc(var(--safe-b) + 52px); width: 250px; pointer-events: none; z-index: 2; display: flex; flex-direction: column; gap: 2px; }
.log-line { font-size: 11.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); animation: logfade 6s forwards; }
.log-line.loot { color: #fff59d; } .log-line.exp { color: #b9f6ca; } .log-line.warn { color: #ff8a80; } .log-line.q4 { color: #ffd54f; }
@keyframes logfade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
body.touch #logBox { bottom: auto; top: calc(var(--safe-t) + 210px); width: 210px; }
#fade { position: fixed; inset: 0; background: #fff8e1; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 20; }

/* =====================================================================
   NPC 對話框
   ===================================================================== */
#dialog {
  position: fixed; z-index: 6; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translateX(-50%); width: min(600px, 94vw);
  display: flex; gap: 12px; align-items: flex-start; background: rgba(255, 250, 240, .97); border: 4px solid #fff; outline: 3px solid var(--line);
  border-radius: 18px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); animation: pop .18s ease-out;
}
.dl-face { width: 72px; height: 72px; flex: none; border-radius: 50%; background: #fff center/contain no-repeat; border: 3px solid #ffcc80; display: grid; place-items: center; font-size: 36px; overflow: hidden; }
.dl-face img { width: 100%; height: 100%; object-fit: contain; }
.dl-main { flex: 1; min-width: 0; }
.dl-name { font-weight: 900; color: var(--ink2); font-size: 14px; }
.dl-text { font-size: 14.5px; line-height: 1.7; margin-top: 2px; }
.dl-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; justify-content: flex-end; }
body.touch #dialog { bottom: auto; top: var(--safe-t); width: min(560px, 70vw); }
body.touch .dl-face { width: 54px; height: 54px; }
body.touch .dl-text { font-size: 13px; }

/* =====================================================================
   通用視窗
   ===================================================================== */
#panel {
  position: fixed; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 95vw); max-height: 88vh;
  display: flex; flex-direction: column; background: rgba(255, 250, 240, .98); border: 4px solid #fff; outline: 3px solid var(--line);
  border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: pop .18s ease-out;
}
#panel.wide { width: min(760px, 96vw); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
#dialog { animation-name: popd; }
@keyframes popd { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
body.touch #dialog { animation: none; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px 9px 16px; font-weight: 900; font-size: 18px; background: #ffe0b2; border-radius: 16px 16px 0 0; flex: none; }
.pt { display: flex; align-items: center; gap: 8px; }
.pclose { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; background: var(--line); color: #fff; font-weight: 900; font-size: 15px; cursor: pointer; }
.ptabs { display: flex; gap: 4px; padding: 6px 10px 0; flex: none; overflow-x: auto; scrollbar-width: none; }
.ptabs:empty { display: none; }
.ptabs::-webkit-scrollbar { display: none; }
.tab { font-weight: 900; font-size: 13px; padding: 5px 12px; border-radius: 12px 12px 0 0; background: #efe5da; border: 2px solid #fff; border-bottom: 0; cursor: pointer; white-space: nowrap; }
.tab.on { background: #fff; color: #e65100; }
.tab .badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; background: #ff5252; color: #fff; font-size: 10px; margin-left: 4px; text-align: center; padding: 0 4px; }
.pbody { padding: 12px 14px 14px; font-size: 14px; line-height: 1.6; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; flex: 1; min-height: 0; }
.pbody p { margin: 4px 0; }
.sec { font-weight: 900; margin: 10px 0 6px; color: #8d6e63; display: flex; align-items: center; gap: 6px; }
.sec:first-child { margin-top: 0; }
.sec small { font-weight: 700; opacity: .75; }
.hint { font-size: 12px; opacity: .75; margin-top: 8px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.npc-say { display: flex; gap: 10px; align-items: center; background: #fff3e0; border-radius: 14px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.npc-say .face { width: 48px; height: 48px; flex: none; border-radius: 50%; background: #fff; border: 2px solid #ffcc80; object-fit: contain; display: grid; place-items: center; font-size: 26px; }

/* 按鈕 */
.btn {
  font-weight: 900; font-size: 14px; color: #fff; background: linear-gradient(#ffb74d, #f57c00); border: 3px solid #fff; border-radius: 14px;
  padding: 6px 14px; cursor: pointer; box-shadow: 0 3px 0 #bf5f00; white-space: nowrap; line-height: 1.3;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #bf5f00; }
.btn:disabled { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.btn.small { font-size: 12px; padding: 3px 10px; border-radius: 11px; border-width: 2px; }
.btn.big { font-size: 20px; padding: 10px 40px; border-radius: 28px; border-width: 4px; box-shadow: 0 6px 0 #bf5f00, 0 10px 20px rgba(0, 0, 0, .3); }
.btn.green { background: linear-gradient(#81c784, #388e3c); box-shadow: 0 3px 0 #1b5e20; }
.btn.blue { background: linear-gradient(#64b5f6, #1976d2); box-shadow: 0 3px 0 #0d47a1; }
.btn.purple { background: linear-gradient(#ce93d8, #8e24aa); box-shadow: 0 3px 0 #4a148c; }
.btn.red { background: linear-gradient(#ef9a9a, #e53935); box-shadow: 0 3px 0 #b71c1c; }
.btn.gray { background: linear-gradient(#bcaaa4, #8d6e63); box-shadow: 0 3px 0 #5d4037; }
.btn.ghost { background: rgba(255, 255, 255, .85); color: var(--ink2); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 800; background: #fff; border-radius: 9px; padding: 1px 7px; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); white-space: nowrap; }
.need { font-weight: 800; white-space: nowrap; }
.need.ok { color: #2e7d32; } .need.no { color: #d32f2f; }

/* 開關 */
.switch { position: relative; width: 46px; height: 26px; border-radius: 13px; background: #bcaaa4; border: 2px solid #fff; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .2s; }
.switch.on { background: #43a047; }
.switch.on::after { left: 22px; }
input[type=range] { width: 100%; accent-color: #f57c00; }
select { font-family: inherit; font-weight: 800; font-size: 13px; padding: 3px 6px; border-radius: 8px; border: 2px solid #ffcc80; background: #fffaf0; color: var(--ink); }

/* 一般列表列（商店、配方、任務、副本…） */
.prow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(141, 110, 99, .09); margin-bottom: 7px; }
.prow .ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-size: 28px; border-radius: 10px; background: #fff; }
.prow .ic .ii { width: 36px; height: 36px; }
.prow .info { flex: 1; min-width: 0; font-size: 12px; line-height: 1.55; }
.prow .info b { font-size: 14px; }
.prow .act { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.prow.done { background: #e8f5e9; }
.prow.lock { opacity: .55; }
.pbar { height: 8px; background: #e0d6cc; border-radius: 5px; overflow: hidden; margin-top: 3px; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb74d, #ff7043); border-radius: 5px; }
.pbar.green i { background: linear-gradient(90deg, #a5d6a7, #43a047); }
.pbar.pink i { background: linear-gradient(90deg, #f8bbd0, #ec407a); }

/* =====================================================================
   角色素質（C）
   ===================================================================== */
.char-top { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.char-face { width: 84px; height: 84px; flex: none; border-radius: 18px; background: radial-gradient(#fff, #ffe0b2); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); display: grid; place-items: center; overflow: hidden; font-size: 44px; }
.char-face img { width: 92%; height: 92%; object-fit: contain; }
.char-meta b { font-size: 18px; }
.char-meta .job { display: inline-block; font-size: 12px; font-weight: 900; color: #fff; border-radius: 8px; padding: 0 8px; background: var(--ink2); }
.ptsline { display: flex; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }
.ptsline .chip { font-size: 12.5px; }
.ptsline .chip b { color: #e65100; font-size: 15px; }
.stat-row { display: grid; grid-template-columns: 56px 1fr 42px 34px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: rgba(141, 110, 99, .08); margin-bottom: 5px; }
.stat-row .sn { font-weight: 900; font-size: 15px; }
.stat-row .sn small { display: block; font-size: 10px; opacity: .7; font-weight: 800; }
.stat-row .sd { font-size: 11.5px; line-height: 1.4; opacity: .85; }
.stat-row .sv { font-weight: 900; font-size: 18px; text-align: right; }
.stat-row .sv small { font-size: 11px; color: #2e7d32; display: block; line-height: 1; }
.plus { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; background: linear-gradient(#ffb74d, #f57c00); color: #fff; font-weight: 900; font-size: 18px; cursor: pointer; box-shadow: 0 2px 0 #bf5f00; }
.plus:disabled { filter: grayscale(1); opacity: .35; cursor: default; }
.stat-row.STR .sn { color: #e53935; } .stat-row.AGI .sn { color: #43a047; } .stat-row.VIT .sn { color: #fb8c00; } .stat-row.INT .sn { color: #5e35b1; }
.derived { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 4px; }
.derived div { background: #fff; border-radius: 10px; padding: 4px 8px; font-size: 11px; font-weight: 800; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.derived div b { display: block; font-size: 15px; color: var(--ink2); }
.job-box { margin-top: 10px; padding: 10px; border-radius: 14px; background: linear-gradient(135deg, #fff8e1, #ffe0b2); border: 2px dashed #ffb74d; text-align: center; }
.job-box b { font-size: 16px; color: #e65100; }

/* =====================================================================
   背包與裝備（B）
   ===================================================================== */
.bag-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 12px; }
.equip-doll { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
.equip-doll .doll { grid-column: 1 / -1; height: 96px; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #fff, #efe5da); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.equip-doll .doll img { height: 88px; }
.eslot { position: relative; height: 62px; border-radius: 12px; border: 3px solid var(--q0); background: #fff; display: flex; align-items: center; gap: 6px; padding: 4px 6px; cursor: pointer; overflow: hidden; }
.eslot .ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-size: 26px; }
.eslot .ic .ii { width: 40px; height: 40px; }
.eslot .en { font-size: 10.5px; font-weight: 900; line-height: 1.25; min-width: 0; }
.eslot .en small { display: block; opacity: .6; font-size: 9.5px; }
.eslot.empty { border-style: dashed; border-color: #d7ccc8; background: rgba(255, 255, 255, .5); }
.eslot.empty .ic { opacity: .3; filter: grayscale(1); }
.bag-side .row { margin-bottom: 6px; }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.bslot { position: relative; aspect-ratio: 1; border-radius: 11px; border: 3px solid var(--q0); background: #fff; display: grid; place-items: center; font-size: 26px; cursor: pointer; overflow: hidden; }
.bslot .ii { width: 78%; height: 78%; }
.bslot .cnt { position: absolute; right: 3px; bottom: 0; font-size: 11px; font-weight: 900; color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.bslot .en { position: absolute; left: 3px; top: 1px; font-size: 10.5px; font-weight: 900; color: #fff; background: rgba(0, 0, 0, .5); border-radius: 6px; padding: 0 3px; line-height: 1.3; }
.bslot .new { position: absolute; right: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: #ff5252; }
.bslot .eq { position: absolute; left: 2px; bottom: 1px; font-size: 9px; font-weight: 900; color: #fff; background: #43a047; border-radius: 5px; padding: 0 3px; }
.bslot.blank { border: 2px dashed #e0d6cc; background: transparent; cursor: default; }
.bslot.sel { outline: 3px solid #ff9800; outline-offset: 1px; }
.bag-cap { font-size: 12px; font-weight: 800; opacity: .75; }

/* 品質（邊框 / 底色 / 文字） */
.q0 { border-color: var(--q0) !important; } .q1 { border-color: var(--q1) !important; } .q2 { border-color: var(--q2) !important; } .q3 { border-color: var(--q3) !important; } .q4 { border-color: var(--q4) !important; }
.bslot.q1, .eslot.q1 { background: var(--q1b); } .bslot.q2, .eslot.q2 { background: var(--q2b); } .bslot.q3, .eslot.q3 { background: var(--q3b); } .bslot.q4, .eslot.q4 { background: var(--q4b); }
.bslot.q4, .eslot.q4 { box-shadow: 0 0 10px rgba(255, 179, 0, .6); }
.tq0 { color: #757575; } .tq1 { color: var(--q1); } .tq2 { color: var(--q2); } .tq3 { color: var(--q3); } .tq4 { color: #e65100; text-shadow: 0 0 6px rgba(255, 213, 79, .9); }
/* 強化發光：+6 藍、+8 紫、+9 以上金色閃耀 */
.g6 { box-shadow: 0 0 10px 3px rgba(66, 165, 245, .75) !important; }
.g8 { box-shadow: 0 0 12px 4px rgba(171, 71, 188, .8) !important; }
.g9 { box-shadow: 0 0 14px 5px rgba(255, 202, 40, .95) !important; animation: goldglow .9s infinite alternate; }
@keyframes goldglow { to { box-shadow: 0 0 22px 9px rgba(255, 236, 130, 1) !important; } }

/* 物品詳情卡（modal 裡） */
.item-card { min-width: 240px; }
.item-card .ih { display: flex; gap: 10px; align-items: center; }
.item-card .big { width: 64px; height: 64px; flex: none; border-radius: 14px; border: 3px solid var(--q0); background: #fff; display: grid; place-items: center; font-size: 38px; }
.item-card .big .ii { width: 56px; height: 56px; }
.item-card .iname { font-size: 17px; font-weight: 900; line-height: 1.3; }
.item-card .itype { font-size: 11.5px; font-weight: 800; opacity: .7; }
.item-card .istats { margin-top: 8px; font-size: 13px; line-height: 1.7; }
.item-card .istats .base { font-weight: 900; }
.item-card .istats .affix { color: #1565c0; font-weight: 800; }
.item-card .istats .card { color: #ad1457; font-weight: 800; }
.item-card .istats .cmp-up { color: #2e7d32; font-weight: 900; } .item-card .istats .cmp-down { color: #d32f2f; font-weight: 900; }
.item-card .idesc { margin-top: 6px; font-size: 12px; opacity: .8; }
.sockets { display: flex; gap: 4px; margin-top: 4px; }
.sock { width: 22px; height: 22px; border-radius: 6px; border: 2px dashed #ce93d8; display: grid; place-items: center; font-size: 12px; background: #fff; }
.sock.full { border-style: solid; background: #fce4ec; }

/* =====================================================================
   鐵匠鋪：強化
   ===================================================================== */
.forge { text-align: center; }
.forge-item { width: 110px; height: 110px; margin: 6px auto 8px; border-radius: 50%; display: grid; place-items: center; font-size: 56px; position: relative; background: radial-gradient(#fff, #efebe9); border: 4px solid #fff; }
.forge-item .ii { width: 76px; height: 76px; }
.forge-item .lvl { position: absolute; right: -6px; bottom: 2px; font-size: 18px; font-weight: 900; color: #fff; background: var(--ink2); border-radius: 12px; padding: 0 8px; border: 2px solid #fff; }
.forge-item.shake { animation: shake .4s; }
.forge-item.ok { animation: okpop .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes okpop { 50% { transform: scale(1.15); } }
.rate { font-size: 22px; font-weight: 900; }
.rate.safe { color: #2e7d32; } .rate.risk { color: #e65100; } .rate.danger { color: #d32f2f; }
.scroll-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.scroll-pick label { display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 12px; background: #fff; border: 2px solid #e0d6cc; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.scroll-pick label.on { border-color: #ff9800; background: #fff3e0; }
.scroll-pick input { accent-color: #f57c00; }
.forge-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; margin-top: 10px; }
.tiers { display: flex; gap: 6px; justify-content: center; margin-top: 10px; font-size: 12px; font-weight: 800; flex-wrap: wrap; }
.tiers span { padding: 2px 8px; border-radius: 8px; background: #eee; opacity: .5; }
.tiers span.on { opacity: 1; }
.tiers .t6.on { background: #bbdefb; box-shadow: 0 0 8px #42a5f5; }
.tiers .t8.on { background: #e1bee7; box-shadow: 0 0 8px #ab47bc; }
.tiers .t9.on { background: #fff59d; box-shadow: 0 0 8px #ffca28; }

/* =====================================================================
   技能
   ===================================================================== */
.skill-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: rgba(141, 110, 99, .08); margin-bottom: 6px; }
.skill-row .ic { width: 48px; height: 48px; border-radius: 12px; background: #fff; display: grid; place-items: center; font-size: 28px; position: relative; }
.skill-row .ic .ii { width: 42px; height: 42px; }
.skill-row .ic .slv { position: absolute; right: -4px; bottom: -4px; font-size: 10px; font-weight: 900; color: #fff; background: var(--ink2); border-radius: 7px; padding: 0 4px; border: 2px solid #fff; }
.skill-row .info { font-size: 12px; line-height: 1.5; min-width: 0; }
.skill-row .info b { font-size: 14px; }
.skill-row .info .meta { opacity: .7; font-weight: 800; }
.skill-row.lock { opacity: .5; }
.skill-row.lock .ic { filter: grayscale(1); }
.skill-row .key { font-size: 10px; font-weight: 900; background: #ffe0b2; border-radius: 6px; padding: 0 5px; margin-left: 4px; }

/* =====================================================================
   任務（主線 / 每日 / 成就）
   ===================================================================== */
.quest-main { border-radius: 14px; padding: 10px 12px; background: linear-gradient(135deg, #fff8e1, #ffecb3); border: 2px solid #ffca28; margin-bottom: 10px; }
.quest-main .qch { font-size: 11px; font-weight: 900; color: #e65100; }
.quest-main b { font-size: 16px; }
.quest-main .qdesc { font-size: 12.5px; margin: 2px 0 6px; }
.daily-chest { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: #ede7f6; border: 2px dashed #9575cd; margin-top: 8px; }
.daily-chest .chest { font-size: 38px; }
.daily-chest.ready .chest { animation: bob2 .8s infinite; }
@keyframes bob2 { 50% { transform: translateY(-4px) rotate(-4deg); } }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ach div { background: #fff; border-radius: 12px; padding: 6px 8px; font-size: 11.5px; font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.ach div b { display: block; font-size: 12.5px; }
.ach div.got { background: #fff8e1; border: 2px solid #ffca28; }
.ach div.got b::before { content: '🏆 '; }

/* =====================================================================
   寵物
   ===================================================================== */
.pet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pet-card { border-radius: 16px; background: #fff; border: 3px solid #f8bbd0; padding: 8px; text-align: center; position: relative; cursor: pointer; }
.pet-card.on { border-color: #ec407a; box-shadow: 0 0 0 3px rgba(236, 64, 122, .25); }
.pet-card.lock { filter: grayscale(1); opacity: .55; cursor: default; }
.pet-card .pic { height: 72px; display: grid; place-items: center; font-size: 46px; }
.pet-card .pic .ii { width: 64px; height: 64px; }
.pet-card .pn { font-weight: 900; font-size: 14px; }
.pet-card .pa { font-size: 11px; font-weight: 800; color: #ad1457; }
.pet-card .stage { position: absolute; top: 6px; right: 8px; font-size: 10px; font-weight: 900; color: #fff; background: #ec407a; border-radius: 7px; padding: 0 5px; }
.egg { font-size: 40px; display: inline-block; animation: wobble 1.4s infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* =====================================================================
   圖鑑與卡片
   ===================================================================== */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cx { border-radius: 14px; background: #fff; border: 3px solid #e0d6cc; padding: 6px; text-align: center; font-size: 11px; font-weight: 800; position: relative; cursor: pointer; }
.cx .pic { height: 56px; display: grid; place-items: center; font-size: 36px; }
.cx .pic .ii { width: 52px; height: 52px; }
.cx .cn { font-size: 12px; font-weight: 900; }
.cx .kills { opacity: .65; }
.cx.unseen .pic { filter: brightness(0) opacity(.25); }
.cx.unseen .cn { opacity: .4; }
.cx.card { border-color: #ec407a; background: linear-gradient(#fff, #fce4ec); }
.cx.card::after { content: '🃏'; position: absolute; top: 2px; right: 4px; font-size: 14px; }
.cx.active { box-shadow: 0 0 0 3px #ffca28; }
.cx.elite .cn::before { content: '★'; color: #ff8f00; }
.cx.boss .cn::before { content: '👑'; }
.codex-bonus { background: #fce4ec; border-radius: 12px; padding: 8px 10px; font-size: 12.5px; font-weight: 800; margin-bottom: 8px; }

/* =====================================================================
   副本
   ===================================================================== */
.dg-card { border-radius: 16px; overflow: hidden; margin-bottom: 10px; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.dg-card .banner { height: 70px; display: flex; align-items: flex-end; padding: 6px 12px; color: #fff; font-weight: 900; font-size: 18px; text-shadow: 0 2px 4px rgba(0, 0, 0, .6); background: center/cover no-repeat; }
.dg-card .banner.cave { background-image: linear-gradient(transparent, rgba(40, 10, 60, .75)), url(../art/cave/cry-lavender.webp), linear-gradient(135deg, #4a148c, #1a237e); background-size: auto, 90px, auto; background-position: center, right 16px center, center; background-repeat: no-repeat; }
.dg-card .banner.tower { background-image: linear-gradient(transparent, rgba(60, 30, 10, .75)), linear-gradient(135deg, #ff8f00, #6d4c41); }
.dg-card .banner.ninja { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-ninja.webp), linear-gradient(135deg, #558b2f, #3e2723); }
.dg-card .banner.temple { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-sunken.webp), linear-gradient(135deg, #00838f, #0d47a1); }
.dg-card .banner.pyramid { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-pyramid.webp), linear-gradient(135deg, #f9a825, #8d6e63); }
.dg-card .banner.icethrone { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-icethrone.webp), linear-gradient(135deg, #4fc3f7, #283593); }
.dg-card .banner.fortress { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-fortress.webp), linear-gradient(135deg, #546e7a, #bf360c); }
.dg-card .banner.voidtemple { background-image: linear-gradient(transparent, rgba(0,0,0,.55)), url(../art/dungeons/dg-void.webp), linear-gradient(135deg, #6a1b9a, #0d0221); }
.dg-card.locked { opacity: .7; }
.dg-card .body { padding: 8px 12px 10px; background: #fff; font-size: 12.5px; }
.dg-card .tries { font-weight: 900; }
.dg-card .tries b { color: #e65100; font-size: 15px; }
.dg-card .loot { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 6px; }

/* =====================================================================
   系統（存檔 / 匯出匯入 / 設定）
   ===================================================================== */
.save-code { width: 100%; height: 96px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 11px; border-radius: 10px; border: 2px solid #ffcc80; padding: 6px; background: #fffaf0; color: var(--ink); user-select: text; -webkit-user-select: text; word-break: break-all; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed #e0d6cc; font-size: 13px; font-weight: 800; }
.set-row .lab { flex: 1; }
.set-row .lab small { display: block; font-weight: 700; opacity: .7; font-size: 11px; }

/* =====================================================================
   通用小視窗（物品詳情 / 確認）
   ===================================================================== */
#modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(40, 25, 20, .35); }
.mbox { width: min(360px, 92vw); max-height: 86vh; overflow-y: auto; background: #fffaf0; border: 4px solid #fff; outline: 3px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: popm .15s ease-out; }
@keyframes popm { from { opacity: 0; transform: scale(.95); } }
.mbody { font-size: 14px; line-height: 1.6; }
.mbtns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 12px; }
.mbtns:empty { display: none; }

/* =====================================================================
   開始畫面
   ===================================================================== */
#select {
  position: fixed; inset: 0; z-index: 15; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; display: flex; justify-content: center;
  background: linear-gradient(180deg, rgba(255, 236, 179, .3), rgba(129, 199, 132, .15) 60%, rgba(46, 90, 30, .55)), url(../art/ui/key-art.jpg) center / cover, #7cb342;
}
.sel-inner { width: min(1100px, 100%); padding: 22px 16px 26px; text-align: center; margin: auto 0; }
#select h1 { font-size: clamp(30px, 6vw, 54px); color: #fff; text-shadow: 0 3px 0 #f57f17, 0 6px 0 #bf360c, 0 10px 20px rgba(0, 0, 0, .35); letter-spacing: 4px; }
#select h2 { font-size: clamp(18px, 3.2vw, 28px); color: #fffde7; text-shadow: 0 2px 0 #ff8f00, 0 4px 12px rgba(0, 0, 0, .35); margin-top: 2px; letter-spacing: 8px; }
#select .sub { color: #fff; font-weight: 800; margin: 10px 0 12px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.savecard { display: inline-flex; align-items: center; gap: 12px; background: rgba(255, 252, 245, .96); border: 4px solid #fff; border-radius: 22px; padding: 10px 14px; margin: 14px 0 6px; box-shadow: 0 6px 16px rgba(0, 0, 0, .2); text-align: left; }
.sc-face { width: 64px; height: 64px; border-radius: 16px; background: radial-gradient(#fff, #ffe0b2); display: grid; place-items: center; overflow: hidden; font-size: 34px; }
.sc-face img { width: 90%; height: 90%; object-fit: contain; }
.sc-info { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 800; }
.sc-info b { font-size: 18px; }
.namebox { display: inline-flex; align-items: center; gap: 10px; background: rgba(255, 252, 245, .95); border: 4px solid #fff; border-radius: 22px; padding: 8px 14px; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); margin-bottom: 12px; font-weight: 900; }
.namebox input { font-family: inherit; font-size: 18px; font-weight: 900; color: var(--ink); border: 3px solid #ffcc80; border-radius: 14px; padding: 6px 12px; width: min(230px, 52vw); outline: none; background: #fffaf0; user-select: text; -webkit-user-select: text; }
.namebox input:focus { border-color: #ff9800; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.card { --c: #ef5350; --l: #ffcdd2; background: rgba(255, 252, 245, .95); border: 4px solid #fff; border-radius: 22px; padding: 10px 10px 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); text-align: left; }
.card:hover { transform: translateY(-4px); }
.card.sel { transform: translateY(-6px) scale(1.02); box-shadow: 0 0 0 4px var(--c), 0 12px 24px rgba(0, 0, 0, .25); }
.card .pv { height: 118px; border-radius: 14px; background: radial-gradient(circle at 50% 75%, var(--l), #fff 75%); display: grid; place-items: center; overflow: hidden; }
.card .pv img { height: 108px; transition: transform .3s; }
.card.sel .pv img { transform: scale(1.08) translateY(-3px); animation: hop .6s ease-in-out infinite alternate; }
@keyframes hop { to { transform: scale(1.08) translateY(-8px); } }
.card h3 { font-size: 19px; margin: 6px 0 0; color: var(--c); display: flex; align-items: center; gap: 6px; }
.card h3 small { font-size: 11px; color: var(--ink2); background: #fff3e0; border-radius: 8px; padding: 0 6px; }
.card .d { font-size: 12px; opacity: .8; font-weight: 700; }
.card .stat { display: flex; align-items: center; font-size: 11px; font-weight: 800; margin-top: 3px; }
.card .stat i { font-style: normal; width: 34px; }
.card .pips { display: flex; gap: 3px; }
.card .pip { width: 14px; height: 8px; border-radius: 4px; background: #e0d6cc; }
.card .pip.on { background: var(--c); }
.card .sk { margin-top: 5px; font-size: 11.5px; line-height: 1.45; background: rgba(0, 0, 0, .04); border-radius: 10px; padding: 4px 7px; }
.card .sk b { color: var(--c); }
#startBtn, #continueBtn { margin-top: 16px; }
#continueBtn { margin-top: 0; }
.sel-foot { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.tip { color: #fff; font-size: 12px; margin-top: 12px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); line-height: 1.6; }

@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 101, .9); } 50% { box-shadow: 0 0 0 6px rgba(255, 138, 101, 0); } }

/* =====================================================================
   響應式：小螢幕 / 手機橫向
   ===================================================================== */
@media (max-width: 760px), (max-height: 520px) {
  #hud { transform: scale(.8); }
  #topRight { transform: scale(.8); }
  .bag-wrap { grid-template-columns: 1fr; }
  .equip-doll { grid-template-columns: repeat(3, 1fr); }
  .equip-doll .doll { display: none; }
  .derived { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 430px) {
  #hud { transform: scale(.64); }
  #topRight { transform: scale(.66); }
  #hud .track, #hud .buffs { display: none; }
  #panel { max-height: 94vh; }
  .ph { padding: 5px 10px 5px 14px; font-size: 16px; }
  #bossBar { top: calc(var(--safe-t) + 44px); }
  .tb.atk { width: 80px; height: 80px; }
  #actionPad { transform: scale(.9); transform-origin: bottom right; }
}
@media (max-width: 480px) {
  .two { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 50px 1fr 38px 32px; }
}

/* =====================================================================
   世界地圖
   ===================================================================== */
#minimap { cursor: pointer; }
.wmap { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  background: radial-gradient(circle at 90% 10%, #b388ff 0 8%, transparent 18%), radial-gradient(circle at 75% 20%, #e3f2fd 0 10%, transparent 22%),
    radial-gradient(circle at 50% 20%, #eceff1 0 12%, transparent 24%), radial-gradient(circle at 75% 62%, #ffe0b2 0 16%, transparent 28%),
    radial-gradient(circle at 60% 88%, #81d4fa 0 18%, transparent 30%), radial-gradient(circle at 38% 52%, #a5d6a7 0 14%, transparent 26%),
    radial-gradient(circle at 18% 70%, #c5e1a5 0 18%, transparent 30%), linear-gradient(135deg, #f5e6c8, #e8d5b0); background-size: cover; background-position: center; }
.wmap.art { background: center / cover no-repeat; }
.wpin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: none; cursor: pointer; padding: 0; font: inherit; }
.wpin i { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #8d6e63; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); font-style: normal; font-size: 10px; display: grid; place-items: center; }
.wpin.town i { width: 22px; height: 22px; background: #ffd54f; border-color: #e65100; }
.wpin.here i { background: #00e676; border-color: #fff; box-shadow: 0 0 0 3px #00e676, 0 0 12px #00e676; animation: pulse 1s infinite; }
.wpin.lock { opacity: .5; filter: grayscale(1); }
.wpin span { font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
.wregion { margin-top: 10px; }
.wlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.wbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 9px; border-radius: 12px; border: 2px solid #e0d6cc; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.wbtn b { font-size: 13px; } .wbtn small { font-size: 11px; font-weight: 800; opacity: .75; }
.wbtn.here { border-color: #00c853; background: #e8f5e9; }
.wbtn.lock, .wbtn:disabled { opacity: .5; cursor: default; }
body.touch .wmap { aspect-ratio: 16 / 9; height: 52vh; width: auto; margin: 0 auto; }
body.touch .wpin span { font-size: 8.5px; }
body.touch .wpin i { width: 15px; height: 15px; }

/* 第二版：神話品質、套裝、圖鑑地區 */
.q5 { border-color: var(--q5) !important; } .bslot.q5, .eslot.q5 { background: var(--q5b); box-shadow: 0 0 12px rgba(229, 57, 53, .7); animation: mythic 1.6s ease-in-out infinite; }
@keyframes mythic { 50% { box-shadow: 0 0 18px rgba(255, 82, 82, .95); } }
.tq5 { color: #d32f2f; text-shadow: 0 0 6px rgba(255, 138, 128, .9); font-weight: 800; }
.setbox { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0, 191, 165, .08); border: 1.5px dashed #26a69a; font-size: 12.5px; color: #777; }
.setbox b { color: #00897b; display: block; margin-bottom: 2px; } .setbox .on { color: #00796b; font-weight: 700; } .setbox small { display: block; margin-top: 3px; opacity: .8; }
.cx-region { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 12px 2px 6px; font-size: 13px; }
.cx-region span { color: #8d6e63; font-weight: 700; } .cx-region small { color: #aaa; } .cx-region small.on { color: #2e7d32; font-weight: 700; }

/* 第二版：技能欄 6 格、技能視窗 */
.tb.s4 { right: 222px; bottom: 84px; } .tb.s5 { right: 222px; bottom: 8px; }
.skbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.skb { position: relative; width: 54px; height: 54px; border-radius: 12px; border: 2px solid #d7ccc8; background: #fff8e1; display: grid; place-items: center; cursor: pointer; }
.skb .ii { width: 36px; height: 36px; } .skb kbd { position: absolute; top: 1px; left: 4px; font-size: 10px; font-weight: 900; opacity: .7; }
.skb small { font-size: 11px; color: #a1887f; } .skb.lock { opacity: .45; cursor: default; background: #eee; }
.skb.pick { border-color: #ab47bc; animation: ready 1s infinite; }
.skill-row .acts { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.skill-row.ult { background: linear-gradient(90deg, rgba(255,213,79,.18), transparent); border-radius: 10px; }
.deal { background: linear-gradient(90deg, #fff3e0, #ffe0b2); border: 2px solid #ffb74d; border-radius: 12px; padding: 6px 10px; margin-bottom: 6px; font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.deal .ii { width: 22px; height: 22px; }
.deal s { opacity: .55; }
.cat-row { margin-bottom: 6px; gap: 4px; }
.prow.hot { box-shadow: 0 0 0 2px #ffb74d inset; }
.pet-card .stage.evo { background: linear-gradient(90deg, #7e57c2, #f06292); color: #fff; }

.dg-card .banner.ninja, .dg-card .banner.temple, .dg-card .banner.pyramid, .dg-card .banner.icethrone, .dg-card .banner.fortress, .dg-card .banner.voidtemple { background-size: cover; background-position: center; }

/* =====================================================================
   手機版精簡 HUD 與收合選單（2026-12 改版）
   ===================================================================== */
.menu-toggle { display: none; }
body.touch .menu-toggle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
  width: 46px; height: 46px; border-radius: 14px; border: 2px solid #fff; background: var(--paper); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); cursor: pointer; line-height: 1;
}
body.touch .menu-toggle i { font-style: normal; font-size: 20px; font-weight: 900; }
body.touch .menu-toggle span { font-size: 9.5px; font-weight: 900; margin-top: 2px; }
.menu-toggle.dot::after { content: ''; position: absolute; top: 3px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ff5252; box-shadow: 0 0 0 2px #fff; }
#topRight.open .menu-toggle { background: linear-gradient(#ffe082, #ffca28); }
body.touch #topRight { transform: scale(.78) !important; flex-direction: column; }
body.touch #topRight .menu { display: none; }
body.touch #topRight.open .menu {
  display: grid; grid-template-columns: repeat(3, 50px); gap: 6px; position: absolute; top: 100%; right: 0; margin-top: 6px;
  padding: 8px; background: var(--paper); border: 3px solid #fff; border-radius: 18px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); z-index: 6;
}
body.touch #topRight.open .menu button { height: 50px; }
body.touch #topRight .menu kbd { display: none; }
body.touch #minimap { width: 124px; height: 90px; }

body.touch #hud { width: 172px; padding: 5px 7px 6px; border-radius: 14px; border-width: 2px; transform: none !important; }
body.touch .hud-top { gap: 6px; margin-bottom: 2px; }
body.touch .avatar { width: 30px; height: 30px; border-width: 2px; font-size: 16px; }
body.touch .hname { font-size: 12px; gap: 4px; }
body.touch .hname .lv { font-size: 9.5px; padding: 0 4px; }
body.touch .hname .lv b { font-size: 11px; }
body.touch .hclass { display: none; }
body.touch .bar { height: 12px; margin: 2px 0; border-width: 1px; }
body.touch .bar span { font-size: 8.5px; }
body.touch .bar.exp { height: 5px; }
body.touch .bar.exp span { display: none; }
body.touch .money { font-size: 11px; gap: 8px; margin-top: 3px; }
body.touch .ic-coin, body.touch .ic-gem { width: 13px; height: 13px; vertical-align: -2px; }
body.touch .money .pts { font-size: 9.5px; padding: 0 6px; }
body.touch #hud .buffs { display: flex !important; margin-top: 3px; }
body.touch #hud .buff { font-size: 9px; padding: 0 4px; }
body.touch #hud .track { display: block !important; font-size: 9.5px; padding: 2px 6px; margin-top: 4px; border-width: 1px; line-height: 1.35; }
body.touch #hud .track > :not(.tl) { display: none; }
body.touch #logBox { top: calc(var(--safe-t) + 120px); }
#testTag { position: fixed; left: 50%; bottom: 4px; transform: translateX(-50%); z-index: 6; font-size: 11px; font-weight: 900; color: #fff; background: rgba(123, 31, 162, .85); padding: 2px 10px; border-radius: 10px; pointer-events: none; }

/* =====================================================================
   介面美化 v2：視窗、分頁、區塊標題、列表卡片、按鈕
   ===================================================================== */
#panel {
  background: linear-gradient(180deg, #fffdf7 0%, #fff6e6 100%);
  border: 3px solid #fff; outline: 0; border-radius: 22px;
  box-shadow: 0 0 0 3px #c8a27a, 0 0 0 6px rgba(255, 255, 255, .55), 0 18px 40px rgba(40, 20, 0, .45);
}
.ph {
  position: relative; padding: 8px 10px 8px 16px; font-size: 17px; color: #fff; letter-spacing: .5px;
  background: linear-gradient(180deg, #ffb35c 0%, #f07f2a 100%); border-radius: 19px 19px 0 0;
  text-shadow: 0 2px 0 rgba(150, 60, 0, .55); box-shadow: inset 0 -3px 0 rgba(150, 60, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.ph .pt img, .ph .pt .ii { filter: drop-shadow(0 2px 0 rgba(120, 50, 0, .35)); }
.pclose {
  width: 30px; height: 30px; border: 2px solid #fff; background: linear-gradient(#ff8a65, #e64a19);
  box-shadow: 0 2px 0 #a63600; font-size: 14px; text-shadow: none;
}
.pclose:active { transform: translateY(2px); box-shadow: none; }
.ptabs { gap: 5px; padding: 8px 12px 6px; border-bottom: 2px dashed #ecd9c2; }
.tab {
  padding: 4px 13px; border-radius: 999px; border: 0; background: #f3e6d6; color: #8d6e63;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08); transition: background .15s, color .15s;
}
.tab.on { background: linear-gradient(#ffb35c, #f07f2a); color: #fff; box-shadow: 0 2px 0 #b85a12; text-shadow: 0 1px 0 rgba(120, 50, 0, .4); }
.pbody { padding: 10px 14px 14px; scrollbar-width: thin; scrollbar-color: #e0c3a0 transparent; }
.pbody::-webkit-scrollbar { width: 6px; }
.pbody::-webkit-scrollbar-thumb { background: #e0c3a0; border-radius: 3px; }
.sec {
  font-size: 13.5px; color: #a1522a; margin: 14px 0 7px; padding-bottom: 4px;
  border-bottom: 2px solid #f3e0c8;
}
.sec::before { content: ''; width: 5px; height: 15px; border-radius: 3px; background: linear-gradient(#ffb35c, #f07f2a); flex: none; }
.npc-say {
  background: linear-gradient(135deg, #fff8ec, #ffefd6); border: 2px solid #ffe0b2;
  border-radius: 16px; box-shadow: 0 2px 0 rgba(200, 140, 70, .18);
}
.npc-say .face { border-color: #ffb74d; box-shadow: 0 2px 4px rgba(0, 0, 0, .12); }
.prow {
  background: #fff; border: 1.5px solid #f0e2d0; border-radius: 14px; padding: 7px 9px;
  box-shadow: 0 2px 0 rgba(160, 110, 60, .12); transition: transform .1s;
}
.prow:active { transform: scale(.995); }
.prow .ic { background: linear-gradient(#fffaf2, #fbefdd); border: 1.5px solid #f0e2d0; border-radius: 12px; }
.prow .info b { color: #5d3a22; }
.prow.done { background: linear-gradient(90deg, #f1faf1, #fff); border-color: #c8e6c9; }
.prow.lock { opacity: .6; background: #faf6f1; }
.btn { border-width: 2px; border-radius: 13px; text-shadow: 0 1px 0 rgba(0, 0, 0, .22); }
.btn.small { padding: 4px 11px; border-radius: 10px; }
.btn.ghost { background: #fff; color: #8d6e63; border-color: #ecd9c2; text-shadow: none; box-shadow: 0 2px 0 #e2cdb3; }
.btn.gray { text-shadow: none; }
.row.wrap { gap: 6px; }
.chip { border: 1px solid #f0e2d0; box-shadow: none; }
.pbar { background: #f1e5d6; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); }

/* 手機：視窗更扁、更大，字與間距收一點 */
body.touch #panel { width: min(720px, 94vw); max-height: calc(100vh - 16px); top: 50%; }
body.touch #panel.wide { width: min(820px, 96vw); }
body.touch .ph { padding: 5px 8px 5px 14px; font-size: 15px; }
body.touch .pclose { width: 26px; height: 26px; font-size: 12px; }
body.touch .ptabs { padding: 5px 10px 4px; }
body.touch .tab { font-size: 12px; padding: 3px 11px; }
body.touch .pbody { padding: 8px 12px 10px; font-size: 13px; }
body.touch .sec { margin: 10px 0 5px; font-size: 12.5px; }
body.touch .npc-say { padding: 6px 8px; margin-bottom: 7px; font-size: 12px; }
body.touch .npc-say .face { width: 38px; height: 38px; }
body.touch .prow { padding: 5px 7px; margin-bottom: 5px; }
body.touch .prow .ic { width: 36px; height: 36px; }
body.touch .prow .ic .ii { width: 30px; height: 30px; }
body.touch .prow .act { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; max-width: 52%; gap: 4px; }
body.touch .prow .act .btn.small { padding: 3px 9px; }

/* =====================================================================
   連線：隊伍按鈕燈號、隊伍血條、聊天框
   ===================================================================== */
.menu button .net-dot { position: absolute; top: 4px; right: 5px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.net-dot.on { background: #00e676; } .net-dot.wait { background: #ffb300; } .net-dot.off { background: #bdbdbd; }
.menu button em { position: absolute; bottom: 2px; right: 4px; font-style: normal; font-size: 9px; font-weight: 900; color: #2e7d32; }
#partyHud { position: fixed; left: var(--safe-l); top: calc(var(--safe-t) + 178px); z-index: 3; display: flex; flex-direction: column; gap: 3px; width: 168px; }
#partyHud .pm { background: rgba(255, 250, 240, .9); border: 2px solid #fff; border-radius: 10px; padding: 2px 7px 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); cursor: pointer; }
#partyHud .pn { display: block; font-size: 11px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#partyHud .pn small { font-weight: 800; opacity: .7; }
#partyHud .pb { display: block; height: 6px; border-radius: 3px; background: #e0d6cc; overflow: hidden; }
#partyHud .pb i { display: block; height: 100%; background: linear-gradient(90deg, #a5d6a7, #43a047); }
#partyHud .pm.dead { opacity: .6; } #partyHud .pm.dead .pb i { background: #9e9e9e; }
#partyHud .pm.away { opacity: .75; } #partyHud .pw { font-size: 9.5px; font-weight: 800; color: #8d6e63; }
body.touch #partyHud { top: var(--safe-t); left: calc(var(--safe-l) + 224px); width: auto; flex-direction: row; gap: 4px; }
body.touch #partyHud .pm { width: 92px; }
body.touch #partyHud .pn { font-size: 10px; }
body.touch #partyHud .pm { padding: 1px 6px 3px; border-width: 1px; }
#chatBox { position: fixed; z-index: 5; left: var(--safe-l); bottom: calc(var(--safe-b) + 6px); display: none; align-items: center; gap: 6px; }
body.playing #chatBox { display: flex; }
#chatBtn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; background: rgba(255, 250, 240, .92); font-size: 20px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
#chatInput, #chatSend { display: none; }
#chatBox.open #chatInput { display: block; position: absolute; left: 0; bottom: 48px; width: min(320px, 50vw); font: inherit; font-size: 14px; font-weight: 700; padding: 7px 12px; border-radius: 14px; border: 2px solid #ffb74d; outline: none; background: #fffdf7; user-select: text; -webkit-user-select: text; }
#chatBox.open #chatSend { display: inline-block; position: absolute; left: min(330px, calc(50vw + 10px)); bottom: 50px; }
body.touch #chatBox { left: calc(var(--safe-l) + 180px); bottom: auto; top: var(--safe-t); }
body.touch #chatBox.open #chatInput { bottom: auto; top: 0; left: 44px; }
body.touch #chatBox.open #chatSend { bottom: auto; top: 4px; left: calc(min(320px, 50vw) + 52px); }
body.touch #chatBtn { width: 36px; height: 36px; font-size: 17px; }
.log-line.chat { color: #fff; background: rgba(33, 33, 33, .55); }
.log-line.chat.party { background: rgba(27, 94, 32, .6); }
.chatline { font-size: 12.5px; padding: 3px 8px; border-radius: 8px; background: #fff; margin-bottom: 3px; border: 1px solid #f0e2d0; }
.chatline.party { background: #f1faf1; border-color: #c8e6c9; }
body.touch.inparty #toast { top: calc(var(--safe-t) + 40px); }

/* =====================================================================
   手機版精簡狀態列 v3：頭像＋名字＋金幣一排，HP／MP 細條，經驗一條線
   ===================================================================== */
body.touch #hud {
  width: 186px; padding: 4px 7px 5px 5px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .85);
  background: rgba(255, 250, 240, .78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  display: grid; grid-template-columns: 30px 1fr auto; column-gap: 6px; row-gap: 2px; align-items: center;
}
body.touch .hud-top { display: contents; }
body.touch .avatar { grid-column: 1; grid-row: 1 / span 3; width: 30px; height: 30px; border-width: 2px; align-self: center; }
body.touch .hud-id { grid-column: 2; grid-row: 1; }
body.touch .hname { font-size: 11px; gap: 3px; line-height: 13px; }
body.touch .hname .lv { font-size: 8.5px; padding: 0 3px; border-radius: 5px; }
body.touch .hname .lv b { font-size: 9.5px; }
body.touch #hud .money { grid-column: 3; grid-row: 1; margin: 0; font-size: 9.5px; gap: 5px; }
body.touch .ic-coin, body.touch .ic-gem { width: 11px; height: 11px; vertical-align: -2px; }
body.touch #hud .money span { gap: 2px; }
body.touch #hud .money .pts { position: absolute; left: 4px; top: 100%; margin-top: 3px; }
body.touch #hud .bar { grid-column: 2 / span 2; margin: 0; border: 0; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
body.touch #hud .bar.hp { height: 10px; grid-row: 2; }
body.touch #hud .bar.mp { height: 8px; grid-row: 3; }
body.touch #hud .bar span { font-size: 7.5px; }
body.touch #hud .bar.mp span { font-size: 6.5px; }
body.touch #hud .bar.exp { grid-column: 1 / span 3; grid-row: 4; height: 3px; margin-top: 1px; border-radius: 2px; }
body.touch #hud .buffs { grid-column: 1 / span 3; margin: 1px 0 0; }
body.touch #hud .buffs:empty { display: none !important; }
body.touch #hud .track {
  grid-column: 1 / span 3; margin: 2px 0 0; padding: 1px 6px; font-size: 9px; border-width: 1px; border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.touch #hud .track.hidden { display: none !important; }
body.touch #hud .track .tl { display: flex; gap: 4px; justify-content: space-between; overflow: hidden; }
body.touch #hud .track .tl span { overflow: hidden; text-overflow: ellipsis; }
body.touch #chatBox { left: calc(var(--safe-l) + 194px); }
body.touch #partyHud { left: calc(var(--safe-l) + 236px); }
body.touch #logBox { top: calc(var(--safe-t) + 82px); }

/* ---------- 打擊感：連擊、受傷紅框 ---------- */
#combo { position: fixed; z-index: 3; right: calc(var(--safe-r, 0px) + 200px); top: 34%; pointer-events: none; text-align: center; opacity: 0; transition: opacity .25s; --k: 1; }
#combo.on { opacity: 1; }
#combo b { display: block; font-size: 46px; font-weight: 900; line-height: 1; color: #fff; font-style: italic;
  -webkit-text-stroke: 2px #6d3b1e; text-shadow: 0 3px 0 #6d3b1e, 0 0 14px rgba(255, 213, 79, .8); }
#combo span { display: block; font-size: 15px; font-weight: 900; color: #ffe082; text-shadow: 0 2px 0 #6d3b1e; letter-spacing: 2px; margin-top: -2px; }
#combo small { display: block; font-size: 11px; font-weight: 900; color: #b9f6ca; text-shadow: 0 1px 2px #1b5e20; min-height: 13px; }
#combo::after { content: ''; display: block; height: 4px; margin: 3px auto 0; border-radius: 2px; width: calc(70px * var(--k)); background: linear-gradient(90deg, #ffd54f, #ff7043); }
#combo.hot b { color: #ffe082; }
#combo.fire b { color: #ffab91; text-shadow: 0 3px 0 #6d3b1e, 0 0 18px rgba(255, 112, 67, .95); }
#combo.pop b { animation: comboPop .22s ease-out; }
@keyframes comboPop { 0% { transform: scale(1.45) rotate(-6deg); } 100% { transform: scale(1); } }
body.touch #combo { right: calc(var(--safe-r, 0px) + 170px); top: 30%; }
body.touch #combo b { font-size: 34px; }
body.touch #combo span { font-size: 12px; }
#hurtFx { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; box-shadow: inset 0 0 90px 20px rgba(229, 57, 53, .7); }
#hurtFx.on { animation: hurtFlash .35s ease-out; }
@keyframes hurtFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
#fsBtn { display: none; }
body.touch #fsBtn { display: block; width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; background: rgba(255, 250, 240, .92); font-size: 18px; font-weight: 900; line-height: 1; color: #5d4037; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; padding: 0; }
body.touch.fs #fsBtn, body.nofs #fsBtn { display: none; }
body.touch:not(.fs):not(.nofs) #partyHud { left: calc(var(--safe-l) + 280px); }
body.touch #partyHud .pm { width: 84px; }
body.touch .hud-id { min-width: 0; overflow: hidden; }
body.touch .hname { min-width: 0; }
body.touch #hudName { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
body.touch .hname .lv { flex: none; }
body.touch #hud { width: 196px; }
body.touch #hud .money { font-size: 9px; gap: 4px; }
body.touch #chatBox { left: calc(var(--safe-l) + 204px); }
body.touch #partyHud { left: calc(var(--safe-l) + 246px); }
body.touch:not(.fs):not(.nofs) #partyHud { left: calc(var(--safe-l) + 290px); }
body.touch #logBox { top: calc(var(--safe-t) + 106px); }
.set-row .lab { min-width: 150px; }
.set-row input[type=range] { flex: 0 1 200px; min-width: 70px; }
.set-row > b { min-width: 34px; text-align: right; }
