* { 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;
}
#game { display: block; width: 100vw; height: 100vh; 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 {
  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; }
#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 { 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; }
