* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #bfe6ff;
  font-family: "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
/* 用 fixed＋inset 貼齊「真正看得到的範圍」：手機網址列出現或收起時會自動跟著變，不會被擋住（100vh 在手機上會算成網址列收起來的高度） */
#game { display: block; position: fixed; inset: 0; width: 100%; height: 100%; outline: none; }
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* 左上角狀態欄 */
#status {
  position: fixed; top: 12px; left: 12px; width: 210px;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .78); color: #35536e;
  box-shadow: 0 4px 14px rgba(40, 70, 110, .15);
  pointer-events: none;
}
.status-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.status-head .name { font-weight: 800; letter-spacing: 1px; }
#lv { font-weight: 800; color: #e0736b; }
.bar { position: relative; height: 14px; border-radius: 7px; background: rgba(53, 83, 110, .15); overflow: hidden; margin-top: 5px; }
.bar .fill { height: 100%; border-radius: 7px; transition: width .2s; }
.bar span { position: absolute; inset: 0; font-size: 10px; line-height: 14px; text-align: center; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.bar.hp .fill { background: linear-gradient(90deg, #ff7a8a, #ff9fae); }
.bar.mp .fill { background: linear-gradient(90deg, #5f8dff, #9fc0ff); }
.bar.xp { height: 8px; }
.bar.xp .fill { background: linear-gradient(90deg, #ffc94d, #ffe08a); }
.bar.xp span { display: none; }
.fairy-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.fairy-row .bar { flex: 1; margin: 0; }
.fairy-icon { font-size: 15px; }
.bar.stamina .fill { background: linear-gradient(90deg, #6fd6ff, #b8ecff); }
.bar.stamina.tired .fill { background: linear-gradient(90deg, #b5b5c8, #d5d5e3); }

.hint-desktop {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .72); color: #35536e;
  font-size: 12px; white-space: nowrap; pointer-events: none;
}

/* 怪物名字、血條與飄字 */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.mlabel { position: absolute; left: 0; top: 0; text-align: center; white-space: nowrap; }
.mname { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.mname small { font-weight: 400; opacity: .85; }
.mlabel.targeted .mname { color: #ffd6dc; }
.mbar { width: 56px; height: 6px; margin: 2px auto 0; border-radius: 3px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.mfill { height: 100%; background: #ff5a6e; }
.floater { position: absolute; left: 0; top: 0; font-weight: 900; white-space: nowrap; text-shadow: 0 2px 3px rgba(0, 0, 0, .45); }
.floater.dmg { color: #fff; font-size: 20px; }
.floater.crit { color: #ffd84d; font-size: 26px; }
.floater.hurt { color: #ff6b7d; font-size: 18px; }
.floater.xp { color: #ffe08a; font-size: 15px; }
.floater.info { color: #bff0ff; font-size: 14px; }

/* 右下按鈕 */
#buttons { position: fixed; right: 12px; top: 12px; display: flex; align-items: flex-start; gap: 10px; }
.round {
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .85); color: #35536e;
  font-size: 24px; line-height: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(40, 70, 110, .2);
}
.round small { font-size: 10px; margin-top: 2px; }
.round:active { transform: scale(.92); }
#btn-summon.ready { background: #fff4c2; animation: pulse 1.2s infinite; }
#btn-summon.disabled { opacity: .45; }
#btn-summon.hidden { display: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 216, 77, .35); } }

/* 目標框：選到的怪物頭像、名字、血條 */
#target-frame {
  position: fixed; top: 12px; left: 234px; width: 220px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px; border-radius: 40px 14px 14px 40px;
  background: rgba(255, 255, 255, .85); color: #35536e;
  box-shadow: 0 4px 14px rgba(40, 70, 110, .2); border: 2px solid #ff5a6e;
  pointer-events: none;
}
#target-frame[hidden] { display: none; }
#target-frame.boss { border-color: #c05cff; }
#target-face { width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff, #dfe8f1); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); object-fit: cover; }
.tinfo { flex: 1; min-width: 0; }
.tname { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tname small { font-weight: 600; opacity: .7; }
.ttag { margin-left: 4px; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #ffe9ec; color: #d9485c; vertical-align: middle; }
.ttag.calm { background: #e7f6ec; color: #3f8f5a; }
.ttrack { position: relative; height: 12px; margin-top: 4px; border-radius: 6px; background: rgba(53, 83, 110, .15); overflow: hidden; }
#target-fill { height: 100%; background: linear-gradient(90deg, #ff5a6e, #ff8fa0); transition: width .15s; }
#target-hp { position: absolute; inset: 0; font-size: 9px; line-height: 12px; text-align: center; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }

/* 小地圖 */
#minimap-wrap { position: fixed; top: 80px; right: 12px; width: 150px; text-align: center; pointer-events: none; }
#minimap { width: 150px; height: 150px; display: block; border-radius: 50%; box-shadow: 0 4px 14px rgba(20, 30, 50, .3); }
#minimap-name { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: rgba(40, 60, 90, .6); color: #fff; font-size: 11px; font-weight: 700; }

/* 副本：BOSS 血條、進度、互動提示 */
#bossbar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 480px)); min-width: 220px; text-align: center; pointer-events: none; }
#bossbar[hidden], #dungeon-info[hidden], #prompt[hidden] { display: none; }
.boss-name { color: #fff; font-weight: 800; font-size: 15px; text-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.boss-name small { font-weight: 400; opacity: .8; }
.boss-track { position: relative; height: 16px; margin-top: 4px; border-radius: 8px; background: rgba(0, 0, 0, .5); overflow: hidden; border: 2px solid rgba(255, 216, 77, .8); }
#boss-fill { height: 100%; background: linear-gradient(90deg, #c05cff, #ff5a9e); transition: width .15s; }
#boss-hp { position: absolute; inset: 0; font-size: 10px; line-height: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
#dungeon-info { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(30, 24, 44, .75); color: #efe6ff; font-size: 13px; font-weight: 700; pointer-events: none; white-space: nowrap; }
#prompt {
  position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%);
  padding: 10px 18px; border: 0; border-radius: 999px;
  background: rgba(30, 24, 44, .85); color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(181, 140, 255, .6); animation: pulse 1.4s infinite;
}
.floater.cast { color: #ff9ab0; font-size: 22px; }
.floater.gold { color: #ffd84d; font-size: 14px; }
.floater.mana { color: #8fb3ff; font-size: 18px; }
.floater.heal { color: #7cffb2; font-size: 18px; }

/* 技能欄 */
#skillbar {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%);
  display: flex; gap: 8px; padding: 8px; border-radius: 16px;
  background: rgba(255, 255, 255, .55); box-shadow: 0 4px 14px rgba(40, 70, 110, .15);
}
.skill {
  position: relative; width: 56px; height: 56px; border-radius: 12px; border: 0; overflow: hidden;
  background: rgba(255, 255, 255, .95); color: #35536e; font-size: 26px;
  box-shadow: 0 2px 6px rgba(40, 70, 110, .2);
  touch-action: manipulation;
}
.skill:active, .skill.pressed { transform: scale(.9); }
.skill kbd {
  position: absolute; left: 4px; top: 3px; font: 700 10px/1 system-ui, sans-serif; color: #7d93a8;
}
.skill.locked { opacity: .45; }
.skill.nomp .sicon { filter: grayscale(1) opacity(.5); }
.skill.target { background: #fff0f2; }
.skill.pickup { background: #fff8e0; }
.skill .slv { position: absolute; right: 3px; bottom: 2px; font: 700 9px/1 system-ui, sans-serif; color: #7d93a8; }
.skill .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(40, 60, 90, .45); pointer-events: none; }

/* 轉職 */
.bar.xp.capped .fill { background: linear-gradient(90deg, #c49bff, #e2cfff); }
#quest-tracker { position: fixed; top: 150px; left: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(30, 24, 44, .72); color: #fff; font-size: 12px; line-height: 1.6; pointer-events: none; }
#quest-tracker[hidden] { display: none; }
#quest-tracker b { color: #ffd84d; }
#quest-tracker .ok { color: #7cffb2; }
.mentor-say { padding: 10px 12px; border-radius: 12px; background: #f4edff; font-size: 13px; line-height: 1.6; margin-bottom: 10px; }
.job-card { padding: 10px; border-radius: 12px; background: #f1f7fc; margin-bottom: 8px; }
.job-card .top { display: flex; align-items: center; gap: 10px; }
.job-card .top .icon { font-size: 28px; }
.job-card .top .info { flex: 1; display: flex; flex-direction: column; }
.job-card .top small { font-size: 11px; opacity: .75; }
.job-card .skills { font-size: 11px; line-height: 1.7; margin-top: 6px; opacity: .85; }
.job-card .quest { font-size: 12px; font-weight: 700; margin-top: 4px; color: #6b4fa3; }
.job-card button, .job-actions button { border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; background: #6b4fa3; color: #fff; }
.job-card button:disabled { background: #c4ccd4; }
.job-actions { display: flex; gap: 8px; }
.job-actions button { flex: 1; padding: 10px; font-size: 14px; }
.job-actions button.secondary { background: #c4ccd4; color: #35536e; }
.job-actions button.done { background: #ffd84d; color: #5a4200; }
.tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #e9e1f7; color: #6b4fa3; margin-left: 4px; vertical-align: middle; }
.tag.no { background: #ffe9ec; color: #d9485c; }

/* 道具快捷欄 */
#itembar { position: fixed; right: 12px; bottom: 132px; display: flex; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(255, 255, 255, .55); box-shadow: 0 4px 14px rgba(40, 70, 110, .15); }
.item-slot { position: relative; width: 46px; height: 46px; border: 0; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .95); font-size: 22px; box-shadow: 0 2px 6px rgba(40, 70, 110, .2); touch-action: manipulation; }
.item-slot:active, .item-slot.pressed { transform: scale(.9); }
.item-slot.empty { opacity: .45; }
.item-slot.zero .iicon { opacity: .35; }
.item-slot kbd { position: absolute; left: 4px; top: 3px; font: 700 9px/1 system-ui, sans-serif; color: #7d93a8; }
.item-slot .icount { position: absolute; right: 3px; bottom: 2px; font: 800 11px/1 system-ui, sans-serif; color: #35536e; text-shadow: 0 0 3px #fff; }
.item-slot .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(40, 60, 90, .45); pointer-events: none; }
.hot-btns { display: flex; gap: 4px; margin-top: 4px; }
.bag-item .hot-btns button { border: 0; border-radius: 6px; width: 26px; height: 22px; padding: 0; font-size: 11px; font-weight: 800; background: #e3e9ef; color: #6a8196; }
.bag-item .hot-btns button.on { background: #5f8dff; color: #fff; }
.bag-item .use-btn { background: #e0736b; }

/* 背包 */
#bag-panel, #house-panel, #job-panel, #shop-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  padding: 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .95); color: #35536e;
  box-shadow: 0 10px 30px rgba(40, 70, 110, .3);
}
.panel[hidden] { display: none; }
#craft-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 14px; }
#craft-row[hidden] { display: none; }
#craft-row .bar { flex: 1; margin: 0; }
.bar.craft .fill { background: linear-gradient(90deg, #c49bff, #e2cfff); }

.section-title { font-size: 12px; font-weight: 700; opacity: .6; margin: 12px 0 6px; }
.bag-item button, .recipe button {
  border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
  background: #5fb3a1; color: #fff; white-space: nowrap;
}
.bag-item button.on { background: #e0736b; }
.bag-item button:disabled { background: #c4ccd4; }
.bag-item button.discard { background: #c4ccd4; margin-right: 4px; }
.bag-item button.discard.sure { background: #d9485c; }
.gear-q0 { box-shadow: inset 4px 0 0 #3fae5a; }
.gear-q1 { box-shadow: inset 4px 0 0 #3d8bff; }
.gear-q2 { box-shadow: inset 4px 0 0 #ff9124; }
.gear-q3 { box-shadow: inset 4px 0 0 #a44cf0; background: #f6efff; }
.bag-item.worn { outline: 2px solid rgba(224, 115, 107, .35); }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; }
/* 開盲盒：精靈的成果對話框（出現時先把分頁和內容藏起來） */
#house-panel.revealing .tabs, #house-panel.revealing #house-body { display: none; }
#reveal { position: relative; margin-top: 4px; padding: 14px; border-radius: 14px; background: #fffaf0; border: 2px solid #f0d9a8; animation: pop .25s ease-out; }
#reveal::before { content: ''; position: absolute; top: -10px; left: 50%; margin-left: -9px; border: 9px solid transparent; border-top: 0; border-bottom-color: #f0d9a8; }
.reveal-say { font-size: 15px; font-weight: 800; color: #5a3a26; line-height: 1.5; }
.reveal-say.wait span { display: inline-block; animation: dot 1s infinite; font-size: 20px; }
.reveal-say.wait span:nth-child(2) { animation-delay: .15s; }
.reveal-say.wait span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-5px); } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.reveal-gear { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 12px; background: #fff; border-left: 5px solid currentColor; }
.reveal-gear .icon { font-size: 30px; }
.reveal-gear .info { display: flex; flex-direction: column; font-size: 15px; }
.reveal-gear small { color: #6b7280; font-size: 12px; }
.reveal-gear.gear-q2, .reveal-gear.gear-q3 { box-shadow: 0 0 0 3px rgba(255, 201, 60, .35), 0 0 18px rgba(255, 201, 60, .5); }
.reveal-note { margin-top: 8px; font-size: 13px; color: #6b5a4a; }
.reveal-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reveal-items .mat { font-size: 14px; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid #f0e2c4; font-weight: 700; }
.reveal-up { margin-top: 10px; font-size: 13px; font-weight: 800; color: #1f8fb3; }
#reveal-ok { display: block; width: 100%; margin-top: 12px; padding: 11px; border: 0; border-radius: 12px; background: #7cc36a; color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; }
#btn-house.gift { background: #fff4c2; animation: pulse 1.2s infinite; position: relative; }
#btn-house.gift::after { content: '🎁'; position: absolute; top: -6px; right: -6px; font-size: 18px; animation: dot 1s infinite; }
/* 小屋上方：切換精靈 */
#fairy-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.fcell { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 12px; border: 2px solid transparent; background: #f1f7fc; font-size: 13px; cursor: pointer; color: inherit; }
.fcell * { pointer-events: none; }
.fcell .st { font-size: 18px; }
.fcell small { font-size: 11px; opacity: .7; }
.fcell.on { border-color: #7cc36a; background: #effbe9; }
.fcell.hidden-ed b { color: #c98a00; }
.fcell.empty { justify-content: center; background: repeating-linear-gradient(45deg, #f6f6f6, #f6f6f6 6px, #efefef 6px, #efefef 12px); cursor: default; }
.fairy-card.hidden-ed { background: linear-gradient(135deg, #fff6d6, #ffeec2); }
.fairy-card .fname { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.fairy-card .tag { display: inline-block; margin: 3px 4px 0 0; padding: 1px 7px; border-radius: 999px; background: #e3f2ff; color: #1f4f78; font-size: 11px; font-weight: 700; }
.fairy-card .tag.gold { background: #ffe9a8; color: #8a5a00; }
.fairy-card .bar.lvxp .fill { background: linear-gradient(90deg, #b27be0, #d9b3ff); }
button.mini { border: 0; border-radius: 8px; padding: 2px 8px; font-size: 11px; background: #e8eef5; color: #445; cursor: pointer; }
.rename { display: flex; gap: 4px; }
.rename input { width: 100px; padding: 4px 6px; border: 1px solid #ccd; border-radius: 8px; font-size: 14px; }
.rename button { border: 0; border-radius: 8px; padding: 4px 8px; font-size: 12px; background: #7cc36a; color: #fff; }
.rename button[data-rename-cancel] { background: #ccd; color: #445; }
.type-picker { padding: 10px; border-radius: 14px; background: #fffaf0; border: 2px dashed #f0d9a8; margin-bottom: 10px; }
.type-picker small { display: block; margin: 6px 0 4px; font-size: 12px; opacity: .75; }
.type-picker .types { display: flex; flex-wrap: wrap; gap: 5px; }
.pick-type { border: 2px solid #e6dcc6; border-radius: 999px; padding: 4px 10px; background: #fff; font-size: 13px; cursor: pointer; color: inherit; }
.pick-type.on { border-color: #7cc36a; background: #effbe9; font-weight: 800; }
.type-picker .house-btn { margin: 10px 0 0; }
.reveal-say .who { color: #1f8fb3; }
#room { display: block; width: 100%; aspect-ratio: 2 / 1; border-radius: 12px; margin-bottom: 10px; background: #3a2f52; }
.gold-row { margin-top: 5px; font-size: 12px; font-weight: 800; color: #b07a00; }
.skill-lv { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #f1f7fc; margin-bottom: 6px; font-size: 13px; }
.skill-lv .icon { font-size: 22px; }
.skill-lv .info { flex: 1; }
.skill-lv .bar { margin-top: 4px; height: 10px; }
.skill-lv .bar .fill { background: linear-gradient(90deg, #ffc94d, #ffe08a); }
.skill-lv small { font-size: 11px; opacity: .75; }
.skill-lv button { border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; background: #6b4fa3; color: #fff; white-space: nowrap; }
.skill-lv button:disabled { background: #c4ccd4; }
.btn-row { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-row .house-btn { margin: 0; }
.house-btn.home { background: #c9e8ff; color: #1f4f78; }
.tabs button {
  flex: 1; border: 0; border-radius: 10px; padding: 8px 2px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: #eef3f8; color: #6a8196;
}
.tabs button.active { background: #35536e; color: #fff; }
.fairy-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, #e9f8ff, #f6efff); margin-bottom: 10px; }
.fairy-card .big { font-size: 44px; }
.fairy-card .info { flex: 1; }
.fairy-card .mood { font-size: 12px; opacity: .75; margin-top: 2px; }
.fairy-card .bar { margin-top: 6px; }
.house-btn { width: 100%; border: 0; border-radius: 12px; padding: 10px; font-size: 14px; font-weight: 700; background: #ffd84d; color: #5a4200; margin-bottom: 10px; }
.house-btn:disabled { background: #e3e7ec; color: #8a99a8; }
.rules { font-size: 12px; line-height: 1.8; padding: 10px 12px; border-radius: 12px; background: #f1f7fc; }
.job { padding: 10px 12px; border-radius: 12px; background: #f4edff; font-size: 13px; margin-bottom: 10px; }
.job .bar { margin-top: 6px; }
.returns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; }
.returns span { padding: 2px 8px; border-radius: 999px; background: #fff; }
.odds { font-size: 12px; font-weight: 700; margin: -2px 0 8px; }
.recipe { padding: 10px; border-radius: 12px; background: #f1f7fc; margin-bottom: 8px; }
.recipe-top { display: flex; align-items: center; gap: 10px; }
.recipe-top .icon { font-size: 28px; }
.recipe-top .info { flex: 1; display: flex; flex-direction: column; }
.recipe-top small { font-size: 11px; opacity: .75; }
.recipe .mats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; }
.recipe .mat { padding: 2px 8px; border-radius: 999px; background: #fff; }
.recipe .mat.lack { color: #d9485c; background: #ffe9ec; }
.recipe .meta { font-size: 11px; opacity: .7; margin-top: 4px; }
.recipe button:disabled { background: #c4ccd4; }
.recipe.locked-row { opacity: .6; }
.recipe .owned { font-size: 11px; color: #5fb3a1; font-weight: 700; }
.bag-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 17px; }
.bag-head button { border: 0; background: none; font-size: 18px; color: #35536e; }
.bag-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: #f1f7fc; margin-bottom: 6px; }
.bag-item .icon { font-size: 26px; }
.bag-item .info { flex: 1; display: flex; flex-direction: column; }
.bag-item small { font-size: 11px; opacity: .75; }
.bag-item .count { font-weight: 800; }
.bag-empty { padding: 20px 0; text-align: center; opacity: .7; font-size: 14px; }

/* 左下訊息、中間大字 */
#toasts { position: fixed; left: 12px; bottom: 170px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.toast { padding: 5px 12px; border-radius: 10px; background: rgba(40, 60, 90, .6); color: #fff; font-size: 13px; transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translateX(-20px); }
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; font-size: 34px; font-weight: 900; color: #ffd84d; text-shadow: 0 3px 8px rgba(120, 70, 0, .5); opacity: 0; pointer-events: none; }
#banner.show { animation: banner 2s ease-out; }
@keyframes banner { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

#joystick {
  display: none;
  position: fixed; left: 28px; bottom: 36px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  border: 2px solid rgba(255, 255, 255, .6);
  touch-action: none;
}
#knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 2px 8px rgba(40, 70, 110, .3);
}

/* 畫面比較窄時：BOSS 血條和副本進度移到狀態欄下面，避免疊在一起 */
@media (max-width: 820px) {
  #target-frame { top: 128px; left: 12px; width: min(230px, calc(100vw - 190px)); }
  #quest-tracker { top: 200px; }
  #bossbar { top: 200px; left: 12px; transform: none; width: calc(100vw - 190px); min-width: 0; text-align: left; }
  #dungeon-info { top: 200px; left: 12px; transform: none; white-space: normal; max-width: calc(100vw - 190px); }
}

@media (pointer: coarse) {
  .hint-desktop { display: none; }
  #joystick { display: block; }
  .round { width: 48px; height: 48px; font-size: 20px; }
  #skillbar {
    left: auto; right: 14px; bottom: 30px; transform: none;
    display: grid; grid-template-columns: repeat(3, 58px); gap: 8px; background: none; box-shadow: none; padding: 0;
  }
  .skill { width: 58px; height: 58px; }
  .skill[data-slot="1"] { grid-column: 2 / span 2; grid-row: 2 / span 2; width: 124px; height: 124px; border-radius: 50%; font-size: 44px; }
  .skill.target { grid-column: 1; grid-row: 3; border-radius: 50%; }
  .skill.pickup { grid-column: 1; grid-row: 1; border-radius: 50%; }
  .skill[data-slot="2"] { grid-column: 1; grid-row: 2; border-radius: 50%; }
  .skill[data-slot="3"] { grid-column: 2; grid-row: 1; border-radius: 50%; }
  .skill[data-slot="4"] { grid-column: 3; grid-row: 1; border-radius: 50%; }
  .skill kbd { display: none; }
  #itembar { right: auto; left: 50%; transform: translateX(-50%); bottom: 14px; background: none; box-shadow: none; padding: 0; }
  .item-slot kbd { display: none; }
  #status { width: 170px; padding: 8px 10px; }
  #toasts { bottom: 180px; }
  #minimap-wrap { top: 70px; width: 104px; }
  #minimap { width: 104px; height: 104px; }
  #bossbar { top: 118px; width: calc(100vw - 140px); }
  #dungeon-info { top: 118px; font-size: 12px; max-width: calc(100vw - 140px); }
  #prompt { bottom: 250px; }
}

/* 手機直拿：請玩家轉成橫向 */
#rotate-hint { display: none; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (pointer: coarse) and (orientation: portrait) {
  #rotate-hint {
    display: flex; position: fixed; inset: 0; z-index: 100;
    flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background: rgba(24, 32, 48, .92); color: #fff; text-align: center; padding: 24px;
  }
  #rotate-hint .phone { font-size: 64px; animation: tilt 2s ease-in-out infinite; }
  #rotate-hint b { font-size: 20px; }
  #rotate-hint small { font-size: 13px; opacity: .75; }
}

/* 手機橫拿：按鈕排在四個角落，中間留給遊戲畫面 */
@media (pointer: coarse) and (orientation: landscape) {
  #status { top: 8px; left: calc(10px + env(safe-area-inset-left)); width: 170px; padding: 6px 10px; }
  .status-head { margin-bottom: 2px; font-size: 13px; }
  .bar { height: 12px; margin-top: 4px; }
  .bar span { line-height: 12px; font-size: 9px; }

  #minimap-wrap { top: 8px; right: calc(10px + env(safe-area-inset-right)); width: 96px; }
  #minimap { width: 96px; height: 96px; }
  #minimap-name { font-size: 10px; margin-top: 2px; }
  #buttons { top: 8px; right: calc(118px + env(safe-area-inset-right)); gap: 8px; }
  .round { width: 44px; height: 44px; font-size: 18px; }
  .round small { font-size: 9px; }

  #joystick { left: calc(24px + env(safe-area-inset-left)); bottom: 20px; width: 112px; height: 112px; }
  #skillbar { right: calc(12px + env(safe-area-inset-right)); bottom: 14px; grid-template-columns: repeat(3, 52px); gap: 6px; }
  .skill { width: 52px; height: 52px; font-size: 22px; }
  .skill[data-slot="1"] { width: 110px; height: 110px; font-size: 40px; }

  #target-frame { top: 8px; left: calc(190px + env(safe-area-inset-left)); width: 190px; }
  #target-face { width: 40px; height: 40px; }
  #bossbar { top: 70px; left: 50%; transform: translateX(-50%); width: 34vw; text-align: center; }
  #dungeon-info { top: 10px; left: 50%; transform: translateX(-50%); max-width: 34vw; font-size: 11px; }
  #toasts { left: calc(12px + env(safe-area-inset-left)); top: 108px; bottom: auto; }
  #quest-tracker { top: auto; bottom: 150px; left: calc(12px + env(safe-area-inset-left)); font-size: 11px; }
  .toast { font-size: 12px; padding: 4px 10px; }
  #prompt { bottom: 76px; font-size: 13px; }
  #itembar { right: auto; left: 50%; transform: translateX(-50%); bottom: 10px; background: none; box-shadow: none; padding: 0; }
  .item-slot { width: 44px; height: 44px; }
  .item-slot kbd { display: none; }
  #banner { top: 22%; font-size: 26px; }

  #bag-panel, #house-panel, #job-panel, #shop-panel { max-height: 88vh; width: min(460px, 70vw); }
}

/* 登入／註冊 */
#auth { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, rgba(143, 209, 255, .92), rgba(201, 179, 255, .92)); overflow: auto; }
#auth[hidden] { display: none; }
.auth-card { width: min(360px, 100%); padding: 22px; border-radius: 20px; background: #fff; color: #35536e; box-shadow: 0 12px 40px rgba(40, 70, 110, .3); }
.auth-logo { font-size: 22px; font-weight: 900; letter-spacing: 2px; text-align: center; }
.auth-card h2 { margin: 6px 0 14px; font-size: 16px; text-align: center; opacity: .75; }
#auth-form label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
#auth-form input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 2px solid #e3e9ef; border-radius: 10px; font-size: 15px; font-family: inherit; }
#auth-form input:focus { outline: none; border-color: #8fb3ff; }
#auth-msg { min-height: 18px; font-size: 13px; color: #d9485c; margin-bottom: 6px; }
#auth-submit { width: 100%; padding: 12px; border: 0; border-radius: 12px; background: #5fb3a1; color: #fff; font-size: 16px; font-weight: 800; }
#auth-submit:disabled { opacity: .6; }
#auth-switch { width: 100%; margin-top: 10px; border: 0; background: none; color: #6b8bd6; font-size: 13px; text-decoration: underline; }
#auth[data-mode="login"] .reg-only { display: none; }
#auth .import-only { display: none; }
#auth[data-mode="import"] .import-only { display: block; }
#auth[data-mode="import"] #auth-form, #auth[data-mode="import"] #auth-switch { display: none; }
#import-info { font-size: 14px; line-height: 1.6; }
#auth-pass-row[hidden] { display: none !important; }
#account-row { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e3e9ef; font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#account-row[hidden] { display: none; }
#account-row button { border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; background: #c4ccd4; color: #35536e; }
.auth-sub { text-align: center; font-size: 11px; letter-spacing: 3px; opacity: .55; margin-top: 2px; }

/* 製作頁：選裝備 */
.picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 4px; }
.picker .pick { height: 40px; border: 2px solid transparent; border-radius: 10px; background: #eef3f8; font-size: 20px; padding: 0; }
.picker .pick.on { border-color: #6b4fa3; background: #f4edff; }
.d-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
.recipe .d-row button { width: 26px; height: 26px; padding: 0; border-radius: 8px; background: #6b4fa3; font-size: 14px; }
.d-row b { min-width: 16px; text-align: center; }

/* 放生 */
.house-btn.release-btn { background: #eef3ea; color: #3d6b35; }
.house-btn.release-btn:disabled { opacity: .55; }
.release.sure { padding: 10px; border-radius: 12px; background: #fff1ee; border: 2px solid #f3b6aa; margin-bottom: 10px; font-size: 13px; color: #7a2e22; }
.release.sure .btn-row { display: flex; gap: 6px; margin-top: 8px; }
.house-btn.danger { background: #e0736b; color: #fff; }
.mentor-say s, .bag-item s { opacity: .5; margin-left: 4px; }

/* 線上版：其他玩家的名牌、對話泡泡 */
.plabel { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; pointer-events: none; white-space: nowrap; }
.plabel .pname { font-size: 13px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 0 6px rgba(0, 0, 0, .35); }
.plabel .psub { font-size: 11px; font-weight: 700; color: #fff4c2; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.plabel .bubble { max-width: 200px; white-space: normal; margin-bottom: 6px; padding: 6px 10px; border-radius: 14px; background: #fff; color: #333; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); position: relative; animation: pop .2s ease-out; word-break: break-word; text-align: center; }
.plabel .bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #fff; }
.plabel.self .pname, .plabel.self .psub { display: none; }

/* 聊天紀錄（左下） */
#chat { position: fixed; left: 12px; bottom: 150px; width: min(330px, 42vw); z-index: 5; pointer-events: none; }
#chat-log { max-height: 150px; overflow-y: auto; padding: 6px 8px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7); background: rgba(20, 24, 40, .0); transition: background .3s, opacity .6s; opacity: .55; pointer-events: auto; }
#chat.fresh #chat-log, #chat.typing #chat-log { opacity: 1; background: rgba(20, 24, 40, .35); }
#chat-log:empty { display: none; }
.cline b { color: #9fe6ff; }
.cline.me b { color: #ffd84d; }
.cline.sys { color: #c9d4e4; font-size: 12px; font-style: italic; }
#chat-form { margin-top: 6px; pointer-events: auto; }
#chat-input { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 2px solid #9fe6ff; border-radius: 999px; font-size: 15px; background: rgba(255, 255, 255, .95); outline: none; }

/* 在別處登入 */
#kicked { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(20, 24, 40, .6); padding: 16px; }
#kicked .box { max-width: 360px; padding: 20px; border-radius: 18px; background: #fff; text-align: center; color: #333; }
#kicked b { font-size: 18px; }
#kicked p { font-size: 14px; line-height: 1.6; color: #555; }
#kicked button { border: 0; border-radius: 12px; padding: 10px 16px; background: #7cc36a; color: #fff; font-size: 15px; font-weight: 800; }

@media (max-width: 820px), (pointer: coarse) {
  #chat { bottom: auto; top: 50%; transform: translateY(-50%); width: min(260px, 38vw); }
  #chat-log { max-height: 110px; font-size: 12px; }
}
/* 有設 display 的元素，hidden 時一定要藏起來 */
#kicked[hidden], .plabel[hidden], #chat[hidden], #chat-form[hidden] { display: none; }
.credits { margin-top: 10px; font-size: 11px; opacity: .55; text-align: center; }

/* 人生 RPG：冒險手帳 */
#book-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px)); max-height: 80vh; overflow: auto;
  padding: 14px; border-radius: 16px; background: rgba(255, 252, 244, .97); color: #35536e;
  box-shadow: 0 10px 30px rgba(40, 70, 110, .3);
}
.book-seals { margin-left: auto; margin-right: 10px; font-weight: 800; color: #3d7fb0; }
.seal-row { color: #3d7fb0; }
#book-tabs button { flex: 1; padding: 6px 2px; font-size: 12px; }
.lhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lhead b { font-size: 16px; display: block; }
.lhead small { font-size: 12px; opacity: .7; }
.lstreak { text-align: right; font-weight: 800; color: #e0736b; }
.lstreak small { display: block; color: #35536e; font-weight: 400; }
.bar.lseal { margin: 6px 0; height: 8px; }
.bar.lseal .fill { background: linear-gradient(90deg, #7fc9f2, #b27be0); }
.lfocus { margin: 8px 0; padding: 10px; border-radius: 12px; background: #e9f6ff; border: 2px solid #9fd5f5; font-size: 13px; }
.lfocus small { display: block; margin-top: 4px; opacity: .7; }
.lfocus button { margin-left: 6px; }
.ltask .info { flex: 1; min-width: 0; }
.ltask .info b { display: block; word-break: break-word; }
.lbtns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.ltask.done { opacity: .7; }
#book-body button.ok { background: #7cc36a; }
#book-body button.ghost { background: #e8eef5; color: #445; }
#book-body button.danger { background: #e0736b; }
#book-body button:disabled { opacity: .45; }
.lform { padding: 10px; border-radius: 14px; background: #fff; border: 2px dashed #e6dcc6; }
.lform input[type=text] { width: 100%; box-sizing: border-box; padding: 9px 12px; border: 2px solid #d6e6f2; border-radius: 10px; font-size: 15px; }
.lcats { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.lopts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.lopts select { padding: 5px 8px; border-radius: 8px; border: 1px solid #ccd; max-width: 100%; }
.lform .house-btn { margin: 0; }
.lcalnav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lweek, .lcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.lweek span { font-size: 11px; opacity: .6; }
.lday { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; font-size: 13px; background: #f1f5f9; cursor: pointer; }
.lday small { font-size: 9px; opacity: .7; }
.lday.empty { background: none; cursor: default; }
.lday.lv1 { background: #dcefff; } .lday.lv2 { background: #b9dcff; } .lday.lv3 { background: #a7c4ff; } .lday.lv4 { background: #c6a7ff; color: #fff; }
.lday.today { outline: 2px solid #e0736b; }
.lday.sel { box-shadow: 0 0 0 3px #35536e inset; }
.lbar { display: grid; grid-template-columns: 70px 1fr 24px; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; }
.lbar .bar { margin: 0; height: 8px; }
#focus-chip { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; border: 0; border-radius: 999px; padding: 7px 14px;
  background: rgba(31, 79, 120, .9); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#focus-chip[hidden] { display: none; }
@media (max-width: 820px), (pointer: coarse) {
  #book-panel { max-height: 88vh; width: min(480px, 72vw); }
  #focus-chip { top: 54px; }
}
.lbar .bar .fill { background: linear-gradient(90deg, #7fc9f2, #b27be0); }
/* 視窗比較窄（電腦小視窗）：右上按鈕排成兩排，不要蓋到左上的狀態框；小地圖跟著往下移 */
@media (max-width: 700px) and (pointer: fine) {
  #buttons { flex-wrap: wrap; justify-content: flex-end; width: calc(100vw - 270px); }
  #minimap-wrap { top: 150px; }
}
.round[hidden] { display: none; } /* 圓按鈕有設 display，要另外寫藏起來的規則（全螢幕、聊天按鈕只在需要時出現） */

/* 人生 RPG：今日委託卡片、本週契約 */
.qcard { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 14px; background: #fff; border: 2px solid #f0e2c4; box-shadow: 0 2px 6px rgba(40, 70, 110, .06); }
.qcard .qnpc { font-size: 26px; }
.qcard .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qcard .info b { font-size: 15px; word-break: break-word; }
.qcard .info small { font-size: 12px; opacity: .7; }
.qcard.done { opacity: .65; background: #f4fbf1; border-color: #cfe9c4; }
.lnotice { margin: 8px 0; padding: 9px 10px; border-radius: 12px; background: #fff5df; border: 1px solid #f0d9a8; font-size: 13px; }
.lnotice button { margin: 6px 6px 0 0; }
.lempty { padding: 12px; border-radius: 14px; background: #fff; border: 2px dashed #e6dcc6; text-align: center; font-size: 13px; }
.lempty p { margin: 6px 0 10px; opacity: .8; }
.lnpcs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 8px; }
#book-body .lnpcs button { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 12px; font-size: 14px; }
.lnpcs small { font-size: 11px; opacity: .7; font-weight: 400; }
.lstep { display: inline-flex; align-items: center; gap: 4px; }
.lstep b { font-size: 12px; min-width: 34px; text-align: center; }
#book-body .lstep button { padding: 4px 9px; }
.bar.lprog { height: 6px; margin-top: 4px; }
.bar.lprog .fill { background: linear-gradient(90deg, #ffb38a, #ffd84d); }
#book-body > .house-btn { margin-top: 12px; }

/* NPC 對話框（畫面下方） */
#npc-dialog { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 12; width: min(560px, calc(100vw - 24px)); max-height: 60vh; overflow: auto;
  padding: 12px 14px; border-radius: 18px; background: rgba(255, 252, 244, .97); border: 3px solid #f0d9a8; box-shadow: 0 10px 30px rgba(40, 70, 110, .3); color: #4a3a2a; animation: pop .2s ease-out; }
#npc-dialog[hidden] { display: none; }
.nd-head { display: flex; align-items: center; gap: 8px; }
#nd-icon { font-size: 28px; }
#nd-name { font-size: 16px; }
#nd-role { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #f6e7c8; }
#nd-close { margin-left: auto; border: 0; background: none; font-size: 18px; color: #8a7a6a; cursor: pointer; }
#nd-say { margin: 8px 2px 10px; font-size: 15px; line-height: 1.6; }
#nd-options { display: flex; flex-wrap: wrap; gap: 6px; }
#nd-options button { border: 2px solid #e6d3a8; border-radius: 999px; padding: 7px 14px; background: #fff; color: #4a3a2a; font-size: 14px; font-weight: 700; cursor: pointer; }
#nd-options button:hover { background: #fff3d6; }
#nd-options button.ghost { border-color: #e2e6ec; color: #778; font-weight: 400; }
#nd-input { display: flex; gap: 6px; margin-bottom: 8px; }
#nd-input[hidden] { display: none; }
#nd-text { flex: 1; padding: 9px 12px; border: 2px solid #9fd5f5; border-radius: 12px; font-size: 15px; }
#nd-ok { border: 0; border-radius: 12px; padding: 0 16px; background: #7cc36a; color: #fff; font-weight: 800; }
@media (pointer: coarse) and (orientation: landscape) {
  #npc-dialog { bottom: 8px; max-height: 70vh; width: min(520px, 62vw); }
  #nd-say { font-size: 14px; margin: 4px 2px 8px; }
  #nd-options button { padding: 6px 11px; font-size: 13px; }
}
/* 委託卡片：名稱一整行，按鈕放下面一排，窄螢幕也不會把字擠成直的 */
.qcard { flex-wrap: wrap; }
.qcard .info { flex: 1 1 160px; }
.qcard .lbtns { flex: 1 1 100%; justify-content: flex-end; }
.ltask { flex-wrap: wrap; }
.ltask .info { flex: 1 1 160px; }
.ltask .lbtns { flex: 1 1 100%; }

/* 2026-10-05 生活雛形：今日指引、足跡、今天過得怎麼樣、旅途足跡 */
.section-title .hint { margin-left: 6px; font-weight: 400; opacity: .8; }
.lstreak[data-btab-go] { cursor: pointer; color: #7a9a5a; }
.lwarm { margin: 4px 0 8px; padding: 10px 12px; border-radius: 12px; background: #f1f9ec; border: 1px solid #cfe9c4; font-size: 13px; }
.lform input[type=text] + input[type=text] { margin-top: 6px; }
.lform .house-btn { margin-top: 8px; }
.lbottle { display: block; margin-top: 8px; font-size: 13px; }
.lbottle small { display: block; margin-left: 22px; font-size: 11px; opacity: .65; }
.lbottle.sent { color: #3d7fb0; }
.lev .info em { display: block; font-style: normal; font-size: 12px; opacity: .8; margin-top: 2px; }
.ltrail { margin-bottom: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 2px solid #f0e2c4; }
.ltrail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ltrail-head span { font-size: 12px; }
.ltrail-first { font-size: 12px; font-weight: 700; color: #c98a1a; margin-bottom: 4px; }
.ltrail p { margin: 4px 0; font-size: 13px; line-height: 1.6; }
.ltrail .lquiet { opacity: .6; }
.ltrail .bag-item { margin-bottom: 4px; }

/* 旅人之邸：全螢幕房間（手機為主） */
#home-view { position: fixed; inset: 0; z-index: 30; background: #f3e3c6; touch-action: none; user-select: none; -webkit-user-select: none; }
#home-view[hidden] { display: none; }
#home-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hv-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  display: flex; align-items: center; gap: 10px; pointer-events: none; }
.hv-top b { padding: 6px 14px; border-radius: 999px; background: rgba(255, 252, 244, .92); color: #6a4a2a; font-size: 15px; box-shadow: 0 2px 8px rgba(90, 60, 30, .15); }
#hv-hint { flex: 1; min-width: 0; font-size: 13px; color: #6a4a2a; text-shadow: 0 1px 0 #fff8ec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hv-close { pointer-events: auto; border: 0; border-radius: 999px; padding: 9px 16px; background: #c9e8ff; color: #1f4f78; font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px rgba(30, 60, 90, .2); }
#hv-stash-btn { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); border: 0; border-radius: 18px; padding: 12px 20px;
  background: #ffd84d; color: #5a4200; font-size: 16px; font-weight: 800; box-shadow: 0 4px 12px rgba(90, 60, 0, .25); }
#hv-actions { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; }
#hv-actions[hidden] { display: none; }
#hv-actions button { border: 0; border-radius: 18px; padding: 12px 18px; min-width: 76px; background: rgba(255, 252, 244, .96); color: #6a4a2a; font-size: 15px; font-weight: 800; box-shadow: 0 4px 12px rgba(90, 60, 30, .2); }
#hv-actions button.ok { background: #7cc36a; color: #fff; }
#hv-stash { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px max(14px, env(safe-area-inset-left)) max(74px, calc(env(safe-area-inset-bottom) + 64px));
  display: flex; gap: 8px; overflow-x: auto; background: linear-gradient(transparent, rgba(255, 248, 236, .97) 18%); }
#hv-stash[hidden] { display: none; }
#hv-stash button { flex: 0 0 auto; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 2px solid #ecd9b8; border-radius: 16px; background: #fff; color: #6a4a2a; }
#hv-stash button span { font-size: 28px; }
#hv-stash button b { font-size: 12px; }
#hv-stash button small { font-size: 11px; opacity: .6; }
#hv-stash p { margin: 0 auto; padding: 14px; font-size: 13px; color: #6a4a2a; }
#hv-stash-btn[hidden] { display: none; }
#hv-actions button { white-space: nowrap; }
@media (max-width: 480px) { #hv-actions { gap: 6px; } #hv-actions button { padding: 11px 12px; min-width: 0; font-size: 14px; } }

/* 快速首頁：手帳鋪滿畫面，上面一條標題列；3D 還沒載入 */
#quick-home { position: fixed; inset: 0; z-index: 24; background: linear-gradient(#fff6e6, #f3e3c6); }
#quick-home[hidden] { display: none; }
.qh-top { max-width: 560px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qh-top b { display: block; font-size: 18px; color: #6a4a2a; letter-spacing: 1px; }
.qh-top small { display: block; font-size: 12px; color: #8a6a4a; margin-top: 2px; }
#quick-enter { border: 0; border-radius: 999px; padding: 10px 16px; background: #c9e8ff; color: #1f4f78; font-size: 14px; font-weight: 800; box-shadow: 0 2px 8px rgba(30, 60, 90, .18); white-space: nowrap; }
#quick-enter:disabled { opacity: .7; }
body.quick #book-panel { z-index: 25; top: calc(max(12px, env(safe-area-inset-top)) + 58px); bottom: 12px; transform: translateX(-50%); max-height: none;
  width: min(560px, calc(100vw - 24px)); box-shadow: 0 6px 20px rgba(90, 60, 30, .15); }
body.quick #book-close { display: none; }
body.quick #npc-dialog { z-index: 27; }
body.quick #toasts { z-index: 28; top: auto; bottom: 24px; left: 50%; transform: translateX(-50%); align-items: center; }
#quick-a2hs { max-width: 560px; margin: 8px auto 0; padding: 0 16px; box-sizing: border-box; font-size: 12px; line-height: 1.6; color: #6a4a2a; }
#quick-a2hs[hidden] { display: none; }
#quick-a2hs > b:first-child { display: block; font-size: 13px; }
#quick-a2hs { background: #fff5df; border: 1px solid #f0d9a8; border-radius: 12px; padding: 8px 12px; width: calc(100% - 24px); }
#quick-a2hs-close { margin-top: 4px; border: 0; border-radius: 999px; padding: 4px 12px; background: #f0d9a8; color: #6a4a2a; font-size: 12px; font-weight: 700; }
body.quick.a2hs #book-panel { top: calc(max(12px, env(safe-area-inset-top)) + 160px); }

/* 生活模式（src/cozy.js）：藏起戰鬥介面，戰鬥程式還在、只是先封存 */
.hint-cozy { display: none; }
body.cozy .hint-battle { display: none; }
body.cozy .hint-cozy { display: inline; }
body.cozy #lv, body.cozy #status .bar.hp, body.cozy #status .bar.mp, body.cozy #status .bar.xp,
body.cozy #skillbar, body.cozy #itembar, body.cozy #target-frame, body.cozy #bossbar,
body.cozy #dungeon-info, body.cozy #quest-tracker { display: none !important; }
#hv-stash button.special { border-color: #f2d27a; background: #fffaf0; }

/* 記帳 */
.msub { font-size: 12px; opacity: .7; margin-top: 4px; }
.lform input[type=date], .lform select, #book-body select { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px 10px; border: 2px solid #d6e6f2; border-radius: 10px; font-size: 14px; background: #fff; }
#book-body .lbtns select { width: auto; margin: 0; padding: 4px 6px; font-size: 12px; }
.lstreak.mfree { color: #3d7fb0; }
.mamt { min-width: 64px; text-align: right; }
.lbar:has(.mamt) { grid-template-columns: 70px 1fr 72px; }
input.mbal { width: 84px; padding: 4px 6px; border: 2px solid #d6e6f2; border-radius: 8px; font-size: 13px; }
.mkind { margin-top: 0; }
.minc { color: #4a9a3a; }
.bar.inc .fill { background: linear-gradient(90deg, #a8e6a0, #5fbf7a); }
