/* 橫向試玩的畫面：手機直拿，遊戲畫面鋪滿，介面疊在上面。按鈕和資訊避開瀏海與底部橫條。 */
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #3c4436;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

body {
  position: fixed;
  inset: 0;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---- 上方資訊 ---- */
#hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  color: #fff8ea;
  text-shadow: 0 1px 2px rgba(50, 38, 22, .7);
}

#hudMid {
  position: relative;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  max-width: 230px;
  margin: 0 auto;
}

#title {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 3px;
}

#hpBar {
  position: relative;
  height: 14px;
  border-radius: 8px;
  background: rgba(60, 50, 36, .62);
  overflow: hidden;
}

#hpFill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: #d9765f;
}

#hpText {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 11px;
  line-height: 14px;
}

#mapBox {
  flex: none;
  width: 140px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 234, .4);
  border-radius: 8px;
  background: rgba(40, 32, 22, .62);
}

#mapHead {
  padding: 2px 7px 3px;
  background: rgba(40, 32, 22, .78);
  text-shadow: none;
}

#mapName {
  font-size: 13px;
  font-weight: 700;
  line-height: 16px;
}

#pickupLog { position: fixed; left: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); z-index: 15; font-size: 12px; line-height: 18px; color: #fff3d6; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; animation: none; }
#pickupLog div { animation: logFade 4.5s linear forwards; }
#pickupLog .item { color: #ffd98e; font-weight: 700; }
@keyframes logFade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

#minimap {
  display: block;
  width: 100%;
  height: 70px;
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}

/* ---- 左下搖桿：這塊區域都可以按，按下去底盤就移到手指的位置 ---- */
#stickZone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46%;
  height: 40%;
  touch-action: none;
}

#stickBase {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + 78px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  width: 118px;
  height: 118px;
  margin-left: -59px;
  border-radius: 50%;
  background: rgba(70, 58, 42, .34);
  border: 2px solid rgba(255, 248, 234, .55);
  box-sizing: border-box;
  pointer-events: none;
}

/* 按下去之後用 top 定位在手指的位置 */
#stickBase.on {
  margin-top: -59px;
  background: rgba(70, 58, 42, .45);
}

#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 248, 234, .82);
  box-shadow: 0 2px 6px rgba(50, 38, 22, .35);
  transform: translate(-50%, -50%);
}

/* ---- 右下按鈕：以跳躍鍵為圓心，三招排成弧形 ---- */
#buttons {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  width: 214px;
  height: 180px;
  pointer-events: none;
}

.round {
  position: absolute;
  padding: 0;
  border: 2px solid rgba(255, 248, 234, .7);
  border-radius: 50%;
  background: rgba(70, 58, 42, .5);
  color: #fff8ea;
  font: inherit;
  font-weight: 700;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: visible;
  transition: transform .06s;
}

.round.pressed {
  transform: scale(.92);
  background: rgba(70, 58, 42, .72);
}

#btnJump {
  right: 0;
  bottom: 0;
  width: 86px;
  height: 86px;
  font-size: 18px;
}

.skill {
  width: 62px;
  height: 62px;
  background: rgba(40, 34, 26, .55);
}

#skill0 { right: 104px; bottom: 16px; }
#skill1 { right: 75px; bottom: 84px; }
#skill2 { right: 4px; bottom: 112px; }

.skill img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border-radius: 50%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.skill .cd {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(rgba(25, 20, 14, .68) var(--p, 0%), rgba(0, 0, 0, 0) 0);
  pointer-events: none;
}

.skill .sec {
  position: absolute;
  inset: 0;
  font-style: normal;
  font-size: 20px;
  line-height: 58px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  pointer-events: none;
}

.skill small {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0 5px;
  border-radius: 7px;
  background: rgba(40, 34, 26, .78);
  font-size: 10px;
  font-weight: 400;
  line-height: 14px;
  pointer-events: none;
}

.skill.ready {
  border-color: #ffe7b0;
}

#btnAuto {
  position: fixed;
  left: auto;
  right: 10px;
  bottom: auto;
  top: calc(env(safe-area-inset-top, 0px) + 180px);
  width: auto;
  height: auto;
  padding: 6px 9px;
  border: 1px solid rgba(255, 248, 234, .4);
  border-radius: 12px;
  background: rgba(40, 32, 22, 0.62);
  font-size: 12px;
  font-weight: 400;
  z-index: 20;
}

#btnAuto.on {
  background: #d99a4d;
  border-color: #fff0cc;
  color: #3a2c17;
}

/* ---- 提示和各種小訊息 ---- */
#hint {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  width: min(320px, 82%);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(60, 50, 36, .82);
  color: #fff8ea;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s;
}

#hint.show {
  opacity: 1;
}

#hint b {
  color: #ffd98a;
}

#hint p {
  margin: 3px 0 0;
}

#deathNote {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 12px;
  background: rgba(60, 50, 36, .8);
  color: #fff8ea;
  font-size: 15px;
  display: none;
  pointer-events: none;
}

#rotateNote {
  display: none;
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 12px;
  background: rgba(60, 50, 36, .8);
  color: #fff8ea;
  font-size: 13px;
  pointer-events: none;
}

/* 橫拿也可以玩：不再提示轉成直的 */

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #3c4436;
  color: #fff8ea;
  font-size: 15px;
}

#loadingBar {
  width: 180px;
  height: 8px;
  border-radius: 5px;
  background: rgba(255, 248, 234, .22);
  overflow: hidden;
}

#loadingFill {
  height: 100%;
  width: 0;
  background: #e7c17a;
}

/* 很窄的手機：按鈕整組縮小，才不會蓋到搖桿 */
@media (max-width: 350px) {
  #buttons {
    transform: scale(.8);
    transform-origin: right bottom;
  }

  #stickBase {
    left: calc(env(safe-area-inset-left, 0px) + 68px);
  }
}

/* 試玩頁切換地圖 */

#staffSwitch { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 96px); left: 10px; padding: 6px 12px; border: 0; border-radius: 16px; background: rgba(40,32,22,.62); color: #fff3d6; font-size: 13px; font-weight: 700; z-index: 20; pointer-events: auto; touch-action: manipulation; }

#hatSwitch { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 134px); left: 10px; padding: 6px 12px; border: 0; border-radius: 16px; background: rgba(40,32,22,.62); color: #fff3d6; font-size: 13px; font-weight: 700; z-index: 20; pointer-events: auto; touch-action: manipulation; }

/* 琥珀王房 */
#bossHud { display: none; position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 96px); transform: translateX(-50%); width: min(70vw, 300px); text-align: center; color: #ffe9bf; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.7); pointer-events: none; z-index: 8; }
#bossBar { height: 12px; margin-top: 3px; border-radius: 7px; background: rgba(40,28,16,.78); border: 1px solid rgba(255,214,140,.5); overflow: hidden; }
#bossFill { height: 100%; background: linear-gradient(#ffc64f, #e27d24); transform-origin: left; }
#portalBtn { display: none; position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 455px); transform: translateX(-50%); padding: 11px 18px; white-space: nowrap; border-radius: 22px; background: rgba(120,70,20,.9); border: 1px solid #ffd98e; color: #fff3d6; font-size: 16px; font-weight: 700; text-decoration: none; z-index: 8; }
#bossWin { display: none; position: fixed; left: 50%; top: 34%; transform: translateX(-50%); padding: 20px 34px; border-radius: 18px; background: rgba(40,28,16,.9); border: 1px solid #ffd98e; color: #ffe9bf; text-align: center; z-index: 9; }
#bossWin b { display: block; font-size: 22px; margin-bottom: 14px; white-space: nowrap; }
#bossWin a { display: inline-block; padding: 9px 26px; border-radius: 20px; background: #c47a26; color: #fff; font-weight: 700; text-decoration: none; }
#classSwitch { pointer-events: auto; position: fixed; top: calc(env(safe-area-inset-top, 0px) + 172px); left: 10px; padding: 6px 12px; border: 0; border-radius: 16px; background: rgba(120,70,20,.72); color: #fff3d6; font-size: 13px; font-weight: 700; z-index: 8; }

/* 等級、提示、背包 */
#lvRow { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
#lvRow b { font-size: 12px; color: #ffe9bf; text-shadow: 0 1px 2px rgba(0,0,0,.7); white-space: nowrap; }
#xpBar { flex: 1; height: 5px; border-radius: 3px; background: rgba(40,32,22,.7); overflow: hidden; }
#xpFill { height: 100%; background: #ffcf5e; transform-origin: left; transform: scaleX(0); }
.menuBtn { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 104px); padding: 6px 9px; border: 1px solid rgba(255, 248, 234, .4); border-radius: 12px; background: rgba(40, 32, 22, .62); color: #fff8ea; font: inherit; font-size: 12px; z-index: 20; pointer-events: auto; touch-action: manipulation; }
#settingsBtn { right: 10px; }
#skillBtn { right: 62px; }
#bagBtn { right: 114px; }
#codexBtn { right: 166px; }
#hudMid.dot::after { content: ""; position: absolute; top: 0; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: #d9534f; }
#toasts { position: fixed; left: 50%; top: 24%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; z-index: 30; }
#toasts div { padding: 6px 16px; border-radius: 14px; background: rgba(40,28,16,.86); color: #ffe9bf; font-size: 14px; white-space: nowrap; }
#bag { display: none; position: fixed; inset: 0; background: rgba(20,15,10,.55); z-index: 40; color: #f4e8d0; font-size: 14px; }
#bag .sheet { position: absolute; left: 10px; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 40px); bottom: 20px; max-width: 520px; margin: 0 auto; background: #3b3025; border: 2px solid #8a6f48; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; }
#bag .top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
#bag .top b { font-size: 16px; color: #ffd98e; }
#bag .top span { margin-left: auto; }
#bag button { touch-action: manipulation; font: inherit; color: #fff3d6; }
#bagClose { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #5a4a36; }
#bag .tabs { display: flex; gap: 8px; margin: 0 0 10px; }
#bag .tabs button { flex: 1; padding: 8px; border: 1px solid #6d5c42; border-radius: 10px; background: #4a3d2e; }
#bag .tabs button.on { background: #8a6330; border-color: #ffd98e; }
#bag .tabs em { font-style: normal; padding: 0 6px; border-radius: 8px; background: #d9534f; }
#bag .gear { flex: 1; min-height: 0; display: flex; gap: 10px; }
#bag .portalTalk { margin: 4px 2px 12px; color: #fff3d6; }
#bag .codexCard { margin-bottom: 10px; padding: 10px; border: 1px solid #54462f; border-radius: 12px; background: #2c241b; }
#bag .codexHead { display: flex; align-items: center; gap: 10px; }
#bag .codexHead img { width: 56px; height: 56px; flex: none; }
#bag .codexHead b { display: block; color: #ffd98e; font-size: 15px; }
#bag .codexHead span { display: block; font-size: 14px; }
#bag .codexHead small { color: #a8987e; }
#bag .goBtn { flex: none; margin-left: auto; padding: 8px 14px; border: 1px solid #8a6f48; border-radius: 10px; background: #8a6330; color: #fff3d6; font: inherit; font-size: 13px; }
#bag .codexRow { display: flex; gap: 8px; margin-top: 8px; }
#bag .codexRow i { flex: none; width: 54px; color: #c9bca3; font-size: 12px; font-style: normal; line-height: 15px; padding-top: 4px; }
#bag .chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
#bag .chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 3px; border-radius: 8px; background: #4a3d2e; }
#bag .chip img { width: 24px; height: 24px; flex: none; }
#bag .chip em { font-size: 12px; font-style: normal; white-space: nowrap; }
#bag .mapRow { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 12px 12px; border: 1px solid #6d5c42; border-radius: 12px; background: #4a3d2e; color: #fff3d6; text-align: left; }
#bag .mapRow b { width: 50px; flex: none; color: #ffd98e; font-size: 15px; }
#bag .mapRow span { flex: 1; min-width: 0; font-size: 13px; }
#bag .mapRow i { flex: none; font-style: normal; font-size: 12px; color: #c9bca3; }
#bag .mapRow.here { border-color: #ffd98e; opacity: 1; }
#bag .kindTag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: #5f6f86; color: #fff; font-size: 11px; font-style: normal; line-height: 17px; vertical-align: 1px; }
#bag .kindTag.active { background: #c9762f; }
#bag .bagView { flex: 1; min-width: 0; min-height: 0; display: flex; gap: 8px; }
#bag .wearing { width: 82px; flex: none; box-sizing: border-box; padding: 8px 7px; border: 1px solid #54462f; border-radius: 12px; background: #2c241b; color: #ffd98e; text-align: center; overflow-y: auto; }
#bag .wearing b { font-size: 12px; }
#bag .wear { margin-top: 6px; }
#bag .wear small { display: block; margin-bottom: 3px; font-size: 11px; color: #a8987e; }
#bag .wear .slot { background: #4a3d2e; }
#bag .wear .slot:not([class*=" t"]) { background: #3a2f23; border-color: #54462f; }
#bag .wornTag { position: absolute; left: 2px; bottom: 2px; padding: 0 4px; border-radius: 5px; background: #5a4630; color: #fff; font-size: 10px; line-height: 15px; }
#bag .bagView .right { padding: 7px; box-sizing: border-box; border: 1px solid #54462f; border-radius: 12px; background: #2c241b; }
#bag .bagView .cell, #bag .wear .slot[class*=" t"] { border: 1px solid #7b6647; background: #4a3d2e; }
#bag .bagView .mark { color: #ffd98e; }
#bag .betterTag { position: absolute; left: 3px; top: 1px; color: #5fe07a; font-size: 13px; line-height: 15px; text-shadow: 0 1px 2px #000; }
#bag .bagView .cell i { color: #ffe9bf; text-shadow: 0 1px 2px #000; font-weight: 700; }
#bag .bagView .empty { color: #a8987e; }
#bag .slot, #bag .cell { position: relative; box-sizing: border-box; width: 100%; min-width: 0; aspect-ratio: 1; overflow: hidden; padding: 3px; border: 1px solid #7b6647; border-radius: 9px; background: #2c241b; }
#bag .slot small { color: #a8987e; }
#bag img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
#bag .mark { font-size: 18px; color: #ffd98e; }
#bag .right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#bag .grid { flex: 1; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-content: start; }
#bag .cell i { position: absolute; right: 3px; bottom: 1px; font-style: normal; font-size: 10px; color: #ffe9bf; text-shadow: 0 1px 2px #000; }
#bag .cell.locked { opacity: .42; }
#bag .empty { grid-column: 1 / -1; color: #a8987e; text-align: center; }
#sellAll { padding: 9px; border: 1px solid #6d5c42; border-radius: 10px; background: #4a3d2e; }
#bag .stats { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#bag .sum { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; background: #2c241b; border-radius: 10px; }
#bag .sum b, #bag .pts b, #bag .row b { color: #ffd98e; }
#bag .pts { margin: 12px 0 8px; }
#bag .row { display: flex; align-items: center; padding: 6px 2px; }
#bag .row b { margin-left: auto; margin-right: 14px; }
#bag .row b small { margin-left: 4px; color: #7fe08a; font-size: 12px; font-weight: 400; }
#bag .row button { width: 40px; height: 34px; border: 1px solid #8a6f48; border-radius: 9px; background: #8a6330; font-size: 18px; }
#bag button:disabled { opacity: .4; }
#bag .btns { display: flex; gap: 8px; margin-top: 12px; }
#bag .btns button { flex: 1; padding: 10px 4px; border: 1px solid #8a6f48; border-radius: 10px; background: #6b4f2a; }
#bag .note { color: #a8987e; font-size: 12px; }
#bag .gain { color: #7fe08a; font-size: 12px; }
#bag .range { color: #a8987e; font-size: 12px; }
#bag .statUp { color: #7fe08a; font-weight: 700; }
#bag .statDown { color: #a8987e; }
#bag .pop { position: absolute; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
#bag .box { width: min(84vw, 330px); padding: 14px; background: #4a3b2b; border: 2px solid #ffd98e; border-radius: 14px; }
#bag .head { display: flex; align-items: center; gap: 10px; }
#bag .head img, #bag .head .mark { width: 52px; height: 52px; flex: none; text-align: center; line-height: 52px; }
#bag .head b { display: block; color: #ffd98e; font-size: 16px; }
#bag .head small { color: #c9bca3; }

/* 卷軸、商店 */
#shopBtn { display: none; position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 455px); transform: translateX(-50%); padding: 11px 18px; white-space: nowrap; border-radius: 22px; background: rgba(120,70,20,.9); border: 1px solid #ffd98e; color: #fff3d6; font-size: 16px; font-weight: 700; z-index: 8; touch-action: manipulation; }
#bag u { position: absolute; right: 3px; top: 1px; text-decoration: none; font-size: 11px; font-weight: 700; color: #7fe08a; text-shadow: 0 1px 2px #000; }
#bag .scr { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid #54462f; }
#bag .scr img { width: 44px; height: 44px; flex: none; }
#bag .scr span { flex: 1; }
#bag .scr small { display: block; color: #a8987e; }
#bag .scr b { color: #ffd98e; }
#bag .scr button { padding: 8px 14px; border: 1px solid #8a6f48; border-radius: 10px; background: #8a6330; }
#bag .res { color: #7fe08a; }
#bag .uses { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
#bag .use { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #7b6647; border-radius: 9px; background: #3a2f22; text-align: left; font-size: 13px; }
#bag .use img { width: 32px; height: 32px; flex: none; }
#bag .use span { flex: 1; }
#bag .use b { color: #ffd98e; }
.scrollFx { position: fixed; left: 50%; top: 42%; width: 256px; height: 256px; margin: -128px 0 0 -128px; pointer-events: none; z-index: 60; background-size: auto 256px; background-repeat: no-repeat; animation: scrollFx .68s forwards; }
@keyframes scrollFx { from { background-position-x: 0; } to { background-position-x: var(--w); } }

/* Q 版試打：每個動作一個按鈕 */
#dollMoves { position: fixed; left: 10px; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 100px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; z-index: 20; pointer-events: none; }
#dollMoves button { pointer-events: auto; padding: 9px 2px; border: 1px solid #ffd98e; border-radius: 12px; background: rgba(90,58,24,.88); color: #fff3d6; font-size: 14px; font-weight: 700; touch-action: manipulation; }

/* 離線收穫 */
#offlineBox { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); width: min(78vw, 300px); padding: 18px; border-radius: 16px; background: rgba(40,28,16,.94); border: 2px solid #ffd98e; color: #f4e8d0; text-align: center; font-size: 15px; line-height: 1.8; z-index: 50; }
#offlineBox b { display: block; font-size: 19px; color: #ffd98e; }
#offlineBox p { margin: 2px 0 8px; color: #c9bca3; font-size: 13px; }
#offlineBox button { margin-top: 12px; padding: 9px 34px; border: 0; border-radius: 18px; background: #c47a26; color: #fff; font-size: 15px; font-weight: 700; touch-action: manipulation; }

/* 藥水 */
#potionBadge { position: fixed; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 146px); display: flex; align-items: center; gap: 3px; padding: 2px 10px 2px 4px; border-radius: 14px; background: rgba(40,32,22,.62); color: #fff3d6; font-size: 13px; font-weight: 700; pointer-events: none; z-index: 8; }
#potionBadge img { width: 24px; height: 24px; }
#bag .scr button + button { margin-left: -4px; }

/* 普攻鈕、換職業鈕收起來（只有比較格數的測試頁會打開） */
#btnAttack { right: 172px; bottom: 16px; width: 62px; height: 62px; font-size: 16px; }
#classSwitch { display: none; }

/* 選角、創角 */
#introBox { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; background: #000; }
#introBox video { width: 100%; height: 100%; object-fit: contain; }
#introBox .iSkip { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; padding: 7px 14px; border: 1px solid rgba(255, 248, 234, .5); border-radius: 14px; background: rgba(0, 0, 0, .45); color: #fff8ea; font: inherit; font-size: 14px; }
#introBox .iPlay { position: absolute; padding: 14px 30px; border: 2px solid #ffd98e; border-radius: 26px; background: rgba(120, 70, 20, .9); color: #fff3d6; font: inherit; font-size: 18px; }
#coverScreen { position: fixed; inset: 0; z-index: 210; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 3.5vh); box-sizing: border-box; background: #3a2415 url(sprites/cover2.webp) center 40% / cover no-repeat; }
#coverScreen .cStart { padding: 13px 58px; border: 2px solid #ffd98e; border-radius: 26px; background: rgba(120,70,20,.92); color: #fff3d6; font: inherit; font-size: 18px; font-weight: 700; touch-action: manipulation; }
#selectScreen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px 24px; overflow-y: auto; background: linear-gradient(#5c4a35, #2e241a); color: #f4e8d0; }
#selectScreen .sLogo { font-size: 26px; font-weight: 800; letter-spacing: 3px; color: #ffd98e; text-shadow: 0 2px 5px rgba(0,0,0,.5); }
#selectScreen h1 { margin: 6px 0 12px; font-size: 18px; font-weight: 700; }
#selectScreen .sList { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 7px; }
#selectScreen button { font: inherit; touch-action: manipulation; }
#selectScreen .sCard { display: flex; align-items: center; gap: 10px; padding: 3px 14px 3px 4px; border: 2px solid #7b6647; border-radius: 16px; background: rgba(30,23,16,.6); color: inherit; text-align: left; }
#selectScreen .sCard.on { border-color: #ffd98e; background: rgba(120,84,36,.6); }
#selectScreen .sDel { color: #e8a08f; }
#selectScreen .sTools { display: flex; gap: 10px; }
#selectScreen .sConfirm { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.55); }
#selectScreen .sPanel { width: 100%; max-width: 340px; padding: 18px; border: 2px solid #ffd98e; border-radius: 16px; background: #3b3025; text-align: center; }
#selectScreen .sPanel p { margin: 0 0 6px; font-size: 16px; }
#selectScreen .sPanel small { color: #c9bca3; }
#selectScreen .sRow { display: flex; gap: 10px; margin-top: 16px; }
#selectScreen .sRow button { flex: 1; margin: 0; }
#selectScreen .sMain.sDanger { background: #b8463a; }
#selectScreen .sGender { width: 100%; max-width: 380px; display: flex; gap: 8px; margin-top: 12px; }
#selectScreen .sGender button { flex: 1; padding: 10px; border: 2px solid #7b6647; border-radius: 12px; background: rgba(30,23,16,.6); color: inherit; }
#selectScreen .sGender button.on { border-color: #ffd98e; background: rgba(120,84,36,.6); }
#selectScreen .sPortrait { width: 64px; height: 64px; flex: none; }
#selectScreen .sInfo b { display: block; font-size: 16px; color: #ffe9bf; }
#selectScreen .sInfo span { display: block; margin-top: 2px; font-size: 13px; color: #c9bca3; line-height: 1.5; }
#selectScreen .sName { box-sizing: border-box; width: 100%; max-width: 380px; margin-top: 16px; padding: 12px 14px; border: 2px solid #7b6647; border-radius: 12px; background: #2c241b; color: #fff3d6; font: inherit; font-size: 16px; -webkit-user-select: text; user-select: text; }
#selectScreen .sNote { min-height: 22px; margin-top: 6px; color: #ff9d8a; font-size: 14px; }
#selectScreen .sMain { width: 100%; max-width: 380px; margin-top: 12px; padding: 12px; border: 0; border-radius: 16px; background: #c47a26; color: #fff; font-size: 18px; font-weight: 800; }
#selectScreen .sSub { margin-top: 14px; padding: 10px 24px; border: 1px solid #8a6f48; border-radius: 14px; background: transparent; color: #ffe9bf; font-size: 15px; }

/* Camp NPC interaction shares one position; only the nearest NPC is active. */
#campTalkBtn { display:none; position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom, 0px) + 455px); transform:translateX(-50%); padding:11px 18px; white-space:nowrap; border-radius:22px; background:rgba(120,70,20,.9); border:1px solid #ffd98e; color:#fff3d6; font-size:16px; font-weight:700; z-index:8; touch-action:manipulation; }
#counterMonumentBtn:not([hidden]) { position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom, 0px) + 455px); transform:translateX(-50%); padding:11px 18px; white-space:nowrap; border-radius:22px; background:rgba(120,70,20,.9); border:1px solid #ffd98e; color:#fff3d6; font-size:16px; font-weight:700; z-index:8; touch-action:manipulation; }

#campHomeBtn { display:none; position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom, 0px) + 455px); transform:translateX(-50%); padding:11px 18px; white-space:nowrap; border-radius:22px; background:rgba(120,70,20,.9); border:1px solid #ffd98e; color:#fff3d6; font-size:16px; font-weight:700; z-index:8; touch-action:manipulation; }

/* Opening story: compact tracker and a focusable, blocking dialogue layer. */
#storyTracker { position:fixed; left:12px; top:calc(env(safe-area-inset-top, 0px) + 155px); width:min(275px, calc(100vw - 108px)); padding:9px 12px; white-space:pre-line; text-align:left; color:#fff1d6; background:rgba(44,34,25,.85); border:1px solid #aa8954; border-radius:12px; font:600 12px/1.6 system-ui,sans-serif; z-index:7; }
#storyTracker.complete { opacity:.8; }
.storyVeil { position:fixed; inset:0; z-index:80; background:rgba(12,15,24,.64); display:flex; align-items:center; justify-content:center; padding:calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px); box-sizing:border-box; }
.storyPanel { width:100%; max-width:560px; max-height:100%; overflow:auto; box-sizing:border-box; border:1px solid #ae9264; border-radius:18px; padding:22px; background:#30291f; color:#f9ecd5; box-shadow:0 12px 45px #0007; }
.storyPanel h2 { font-size:20px; line-height:1.5; margin:0 0 14px; color:#ffd890; }
.storyPanel p { font-size:15px; line-height:1.9; margin:10px 0; }
.storyChoices { display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; }
.storyChoices button { flex:1 1 130px; min-height:46px; border:1px solid #b89b66; border-radius:12px; padding:10px 12px; background:#80561f; color:#fff3dc; font:700 15px/1.5 system-ui,sans-serif; touch-action:manipulation; }
.storyChoices button+button { background:#433b31; }
.storyChoices button:focus-visible { outline:3px solid #ffe2a5; outline-offset:3px; }
.homeInterior { max-width:920px; }
.homeInterior>img { width:100%; max-height:48vh; object-fit:contain; display:block; border-radius:10px; }
.homeRevealArt { position:relative; height:min(300px, 34vh); overflow:hidden; background:radial-gradient(ellipse at 50% 85%,#bc884433,transparent 70%); }
.homeRevealArt img { position:absolute; width:100%; height:100%; object-fit:contain; object-position:center bottom; }
.homeRevealArt .locked { animation:homeDark 2.4s ease forwards; }
.homeRevealArt .lit { opacity:0; animation:homeLight 2.4s ease forwards; }
@keyframes homeLight { from {opacity:0} to {opacity:1} }
@keyframes homeDark { from {opacity:1} to {opacity:0} }
@media (prefers-reduced-motion: reduce) { .homeRevealArt .locked {animation:none;opacity:0} .homeRevealArt .lit {animation:none;opacity:1} }

#storyTracker { display:flex; align-items:center; gap:7px; }
#storyTracker>img { width:32px; height:32px; flex:0 0 32px; object-fit:contain; }
#storyTracker>img.pending { opacity:.55; }
.storyQuestItem { display:flex; align-items:center; gap:12px; padding:10px; background:#201b15; border:1px solid #80602f; border-radius:12px; }
.storyQuestItem img { width:64px; height:64px; object-fit:contain; }
.storyQuestItem span { font-size:15px; line-height:1.6; color:#ffe2a5; }

#bag .otherItem { display:flex; align-items:flex-start; gap:14px; padding:14px; background:#30281d; border:1px solid #8b7147; border-radius:12px; }
#bag .otherItem>img { width:64px; height:64px; object-fit:contain; flex:0 0 64px; }
#bag .otherItem>div { min-width:0; } #bag .otherItem b { display:block; font-size:16px; color:#ffe0a0; }
#bag .otherItem b span { color:#fff1d9; margin-left:8px; }
#bag .otherItem small { display:block; margin-top:5px; color:#d0b78b; }
#bag .otherItem p { margin:8px 0 0; font-size:14px; line-height:1.7; }

#bag .otherItem+.otherItem { margin-top:12px; }
#bag .otherItem img.pending { opacity:.5; }
#memoryInvestigate { position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom,0px) + 455px); transform:translateX(-50%); padding:11px 18px; border-radius:22px; border:1px solid #ffd98e; background:#795322ed; color:#fff3d6; font:700 16px/1.5 system-ui,sans-serif; z-index:8; touch-action:manipulation; }
#memoryInvestigate[hidden] { display:none; }

#bag .statHelp { margin-top:18px; padding:14px; border:1px solid #806a47; border-radius:12px; background:#292218; }
#bag .statHelp h3 { margin:0 0 12px; font-size:15px; color:#ffdc98; }
#bag .statHelp dl { margin:0; } #bag .statHelp dl>div { display:grid; grid-template-columns:40px 1fr; gap:10px; margin:9px 0; font-size:13px; line-height:1.7; }
#bag .statHelp dt { font-weight:700; color:#ffe1a7; } #bag .statHelp dd { margin:0; color:#efdbc1; }
#bag .statHelp p { margin:12px 0 0; font-size:12px; line-height:1.7; color:#cbb38f; }

#bag .skillPage { min-width:0; }
#bag .passiveSkillList { margin:0 0 16px; border-bottom:1px solid #6d5b3e; padding-bottom:12px; }
#bag .passiveSkillList summary { padding:8px 0; color:#e4cfad; cursor:pointer; font-size:14px; }
#bag .skillPoints { padding:14px; background:#4a3b23; border:1px solid #806a47; border-radius:12px; font-size:16px; }
#bag .skillPoints>b { color:#ffe1a0; margin-left:10px; font-size:24px; }
#bag .skillPoints small { display:block; color:#cbb997; margin-top:5px; font-size:12px; }
#bag .mainSkillCard { margin-top:14px; padding:16px; border:1px solid #a58349; border-radius:12px; background:#2a231a; }
#bag .mainSkillCard header { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; color:#ffdc98; }
#bag .mainSkillCard h3 { margin:0; font-size:19px; }
#bag .mainSkillCard p { font-size:13px; line-height:1.8; color:#e4d5bd; margin:12px 0; }
#bag .skillNumbers { padding:10px; background:#201c15; border-radius:8px; color:#f7d49a; font-size:13px; line-height:1.8; }
#bag .skillMilestones { list-style:none; padding:0; margin:14px 0; }
#bag .skillMilestones li { padding:9px 0; font-size:13px; line-height:1.7; color:#a99679; }
#bag .skillMilestones b { margin-right:5px; }
#bag .skillMilestones li.learned { color:#eac47e; }
#bag .mainSkillCard .skillNext { color:#c7b58f; font-size:12px; }
#bag button.skillUpgrade,#bag button.skillReset { width:100%; min-height:46px; padding:11px; border-radius:9px; font-size:14px; }
#bag button.skillUpgrade { background:#876031; color:#fff4db; border:1px solid #c69a55; }
#bag button.skillReset { margin-top:14px; background:#4f402b; color:#f5d9a8; border:1px solid #917546; }
#bag button.skillUpgrade:disabled,#bag button.skillReset:disabled { opacity:.45; }
#skillBtn.hasSkillPoints::after { content:''; display:inline-block; width:6px; height:6px; background:#f3c461; border-radius:50%; margin-left:4px; vertical-align:top; }

#guardBreakNotice:not([hidden]) { display: inline-block; padding: 2px 7px; margin-top: 3px; border-radius: 9px; background: rgba(102,25,25,.9); color: #fff1d9; font-size: 11px; font-weight: bold; line-height: 1.3; }

/* 還沒學會的技能變灰 */
.skill.locked { filter: grayscale(1) brightness(.55); opacity: .75; }
.skill.locked.ready { box-shadow: none; }
#bag .mainSkillCard.locked { filter: grayscale(1); opacity: .5; }


/* ==== 介面整理 v1（2026-11-11）：任務框縮小、上方選單排整齊、血條加底框、小地圖縮小 ==== */
/* 血條、經驗、等級：半透明小底框，靠左 */
#hudMid { flex: 0 1 auto; width: min(196px, calc(100vw - 160px)); max-width: none; margin: 0; padding: 5px 9px 6px; border-radius: 12px;
  background: rgba(36, 28, 20, .58); border: 1px solid rgba(255, 248, 234, .22); box-sizing: border-box; }
#title { text-align: left; font-size: 12px; letter-spacing: 1px; margin-bottom: 3px; }
#hud { justify-content: space-between; }
/* 有能力點沒點：寫清楚，不再只是紅點 */
#hudMid.dot::after { content: "可配點"; top: 4px; right: 7px; width: auto; height: auto; padding: 0 6px; border-radius: 8px;
  background: #d9534f; color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; letter-spacing: 0; text-shadow: none; }
/* 小地圖縮小 */
#mapBox { width: 118px; }
#minimap { height: 58px; }
#mapName { font-size: 12px; line-height: 15px; }
/* 上方選單：同寬、等距，排在小地圖下方 */
.menuBtn { top: calc(env(safe-area-inset-top, 0px) + 92px); width: 46px; padding: 5px 0; text-align: center; font-size: 12px; }
#settingsBtn { right: 10px; }
#skillBtn { right: 60px; }
#bagBtn { right: 110px; }
#codexBtn { right: 160px; }
#skillBtn.hasSkillPoints::after { position: absolute; top: 3px; right: 3px; margin: 0; }
#potionBadge { top: calc(env(safe-area-inset-top, 0px) + 128px); }
#btnAuto { top: calc(env(safe-area-inset-top, 0px) + 160px); }
/* 主線任務：縮成一行小字、半透明，點一下看完整內容 */
#storyTracker { top: calc(env(safe-area-inset-top, 0px) + 128px); left: 10px; width: auto; max-width: calc(100vw - 96px); min-width: 120px;
  padding: 5px 9px; white-space: nowrap; background: rgba(36, 28, 20, .55); border-color: rgba(170, 137, 84, .55);
  font: 600 11px/1.5 system-ui, sans-serif; gap: 5px; }
#storyTracker>span { overflow: hidden; text-overflow: ellipsis; }
#storyTracker>img { width: 20px; height: 20px; flex-basis: 20px; }

/* ==== 介面整理 v2：主線換成金色任務框，貼在血條正下方、跟血條同寬；下面空一排留給之後的 buff 圖示 ==== */
#storyTracker { top: calc(env(safe-area-inset-top, 0px) + 82px); left: 10px; width: min(196px, calc(100vw - 160px)); max-width: none; min-width: 0; box-sizing: border-box;
  white-space: normal; align-items: flex-start; padding: 5px 9px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(122, 82, 26, .78), rgba(92, 58, 16, .72)); border: 1px solid rgba(255, 214, 128, .7);
  color: #fff3d0; font: 600 11px/1.45 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
#storyTracker>span { overflow: visible; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#storyTracker b { display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 6px; background: #ffd27a; color: #4a2e08; font-size: 10px; line-height: 15px; vertical-align: 1px; }

/* ==== 選單改成小圖示（GPT 畫）：四顆一排剛好跟小地圖同寬 ==== */
#mapBox { width: 132px; }
.menuBtn { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 9px; }
.menuBtn img { width: 22px; height: 22px; pointer-events: none; }
#settingsBtn { right: 10px; }
#skillBtn { right: 44px; }
#bagBtn { right: 78px; }
#codexBtn { right: 112px; }
#skillBtn.hasSkillPoints::after { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; margin: 0; box-shadow: 0 0 0 1.5px rgba(40,32,22,.9); }

.potion-setting{padding:14px;margin-bottom:12px;border:1px solid #80643d;border-radius:12px;background:#34291f}.potion-setting label{display:block}.potion-setting small{display:block;color:#c8b89a;margin-top:5px}.potion-setting-row{display:flex;align-items:center;gap:8px;margin:12px 0}.potion-setting-row input{width:76px;padding:9px;border:1px solid #9d8054;border-radius:8px;background:#251e18;color:#fff2d4;font:inherit;text-align:center}.potion-setting-row button{padding:9px 18px;border:1px solid #ad8c56;border-radius:8px;background:#70532f;color:#fff2d4;font:inherit}

/* 劍豪霹靂一閃：充能次數（右上角小圓點） */
.skill .charge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #2a6cff; color: #fff; font: 700 13px/20px system-ui, sans-serif; text-align: center; border: 2px solid #e8f0ff; box-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none; z-index: 3; }
.skill .charge.empty { background: #555; border-color: #999; color: #ddd; }

/* 手機橫拿時，瀏海那一側有安全區：右上的按鈕、左邊的主線框也要跟著讓開，才會跟角色卡、小地圖對齊 */
.menuBtn, #potionBadge, #btnAuto { margin-right: env(safe-area-inset-right, 0px); }
#storyTracker { margin-left: env(safe-area-inset-left, 0px); }
