/*
 * 梦幻式场景层:满屏行走地图 + 四角 HUD。
 * 左上小地图与坐标,右上人物/召唤兽气血,右侧任务追踪,左下聊天频道,右下图标栏,底边历练条。
 * HUD 只在场景阶段(body.phase-world)出现;战斗、寻宝、标题与结局各自独占画面。
 */

body.phase-world .overworld-root { inset: 0; }
body:not(.phase-world) .world-hud { display: none; }
.overworld-canvas { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='26' height='26'><path d='M3 2 L22 11 L13 13 L10 23 Z' fill='%23ffe9a8' stroke='%235a2a10' stroke-width='2'/></svg>") 3 2, pointer; }

.world-hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; font-family: "Songti SC", "STSong", serif; }
.world-hud > * { pointer-events: auto; }
.hud-map, .hud-card, .hud-tracker {
  background: linear-gradient(160deg, rgba(43, 31, 22, .86), rgba(28, 20, 14, .9));
  border: 1px solid rgba(224, 184, 109, .75);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .4);
  color: #f6ead0;
  border-radius: 6px;
}

/* 左上:地名 + 坐标 + 小地图 */
.hud-map { position: absolute; left: 12px; top: 12px; padding: 6px 6px 6px; }
.hud-map-name { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 4px 5px; font-size: 15px; color: #ffe9a8; letter-spacing: 1px; }
.hud-coords { color: #9fe3ff; font-size: 13px; font-family: Menlo, monospace; }
.hud-minimap { display: block; width: 240px; height: 136px; border: 1px solid rgba(224, 184, 109, .5); cursor: crosshair; background: #120c08; }

/* 右上:召唤兽 + 人物头像卡 */
.hud-cards { position: absolute; right: 12px; top: 12px; display: flex; gap: 8px; align-items: flex-start; }
.hud-card { display: flex; gap: 8px; padding: 6px 8px 6px 6px; align-items: center; }
.hud-card[hidden] { display: none; }
.hud-card.pet { transform: scale(.86); transform-origin: top right; }
.hud-face { width: 64px; height: 64px; object-fit: cover; object-position: 50% 6%; border-radius: 50%; border: 2px solid #e0b86d; background: radial-gradient(#5a4330, #241812); }
.hud-card-info { width: 168px; display: flex; flex-direction: column; gap: 3px; }
.hud-card-name { font-size: 14px; color: #7dff6a; text-shadow: 0 1px 2px #000; }
.hud-bar { position: relative; height: 13px; border-radius: 2px; background: rgba(0, 0, 0, .55); overflow: hidden; border: 1px solid rgba(0, 0, 0, .6); }
.hud-bar-fill { position: absolute; inset: 0 auto 0 0; }
.hud-bar.hp .hud-bar-fill { background: linear-gradient(180deg, #ff6a5a, #b3261e); }
.hud-bar.mp .hud-bar-fill { background: linear-gradient(180deg, #6ab8ff, #1f5fb3); }
.hud-bar-text { position: relative; display: block; font-size: 10.5px; line-height: 12px; text-align: center; color: #fff; text-shadow: 0 1px 1px #000; font-family: Menlo, monospace; }
.hud-money { font-size: 12.5px; color: #ffd86a; margin-top: 1px; }

/* 右侧:任务追踪 */
.hud-tracker { position: absolute; right: 12px; top: 104px; width: 252px; padding: 6px; }
/* 收起时仍留主线一行(可点寻路);已接的封妖令留一行坐标，其余说明与日常收起 */
.hud-tracker.collapsed .hud-quest:not(.main),
.hud-tracker.collapsed .hud-quest-text,
.hud-tracker.collapsed .hud-quest-go { display: none; }
.hud-quest-brief { display: none; font-size: 14px; color: #9fe3ff; }
.hud-tracker.collapsed .hud-quest.live { display: block; }
.hud-tracker.collapsed .hud-quest.live .hud-quest-title { display: none; }
.hud-tracker.collapsed .hud-quest-brief { display: block; }
.hud-tracker-toggle { float: right; font: 12px "Songti SC", serif; color: #e0b86d; background: none; border: 0; cursor: pointer; letter-spacing: 0; }
.hud-tracker-head { font-size: 14px; letter-spacing: 3px; color: #ffe9a8; padding: 0 4px 6px; border-bottom: 1px solid rgba(224, 184, 109, .4); margin-bottom: 6px; }
.hud-tracker-list { display: flex; flex-direction: column; gap: 6px; }
.hud-quest { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 1px solid transparent; border-radius: 4px; background: rgba(255, 255, 255, .04); color: inherit; font: inherit; cursor: pointer; }
.hud-quest:hover { border-color: rgba(255, 216, 106, .7); background: rgba(255, 216, 106, .1); }
.hud-quest.static { cursor: default; }
.hud-quest-title { font-size: 14px; color: #ffd86a; }
.hud-quest.daily .hud-quest-title { color: #9fe3ff; }
.hud-quest-text { font-size: 12.5px; line-height: 1.5; color: #f2e6cc; margin-top: 3px; }
.hud-quest-go { font-size: 12px; color: #7dff6a; margin-top: 4px; text-align: right; }
.hud-tracker.flash .hud-quest.main { animation: questFlash 1.1s ease-in-out infinite; }
@keyframes questFlash { 50% { border-color: #ffd86a; box-shadow: 0 0 14px rgba(255, 216, 106, .7); } }

/* 左下:聊天频道 */
.hud-chat { position: absolute; left: 12px; bottom: 26px; width: 400px; border-radius: 6px; background: rgba(12, 8, 6, .55); border: 1px solid rgba(224, 184, 109, .35); }
.hud-chat-tabs { display: flex; gap: 2px; padding: 4px 4px 0; }
.hud-chat-tab { font: 12.5px "Songti SC", serif; color: #d9c9a6; background: rgba(255, 255, 255, .06); border: 1px solid rgba(224, 184, 109, .3); border-bottom: 0; border-radius: 4px 4px 0 0; padding: 2px 10px; cursor: pointer; }
.hud-chat-tab.on { color: #ffe9a8; background: rgba(224, 184, 109, .25); }
.hud-chat-log { height: 118px; overflow-y: auto; padding: 5px 8px; font-size: 13px; line-height: 1.55; color: #f6ead0; text-shadow: 0 1px 1px #000; }
.hud-chat-ch { margin-right: 4px; }
.ch-sys .hud-chat-ch { color: #ffd86a; }
.ch-cur .hud-chat-ch { color: #ffffff; }
.ch-team .hud-chat-ch { color: #7dff6a; }
.ch-sys { color: #ffeec2; }

/* 底边:历练条 */
.hud-exp { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background: rgba(10, 6, 4, .78); border-top: 1px solid rgba(224, 184, 109, .5); }
.hud-exp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #ffe58a, #c98a1e); transition: width .5s ease; }
.hud-exp.capped .hud-exp-fill { background: linear-gradient(180deg, #d8d0c0, #8a8070); }
.hud-exp-text { position: relative; font-size: 11.5px; line-height: 15px; text-align: center; color: #fff; text-shadow: 0 1px 1px #000; }

.hud-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: 640px; padding: 9px 18px; border-radius: 20px; background: rgba(255, 248, 230, .95); color: #6a2a14; font-size: 15px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); border: 1px solid #c98a1e; }
.hud-hint[hidden] { display: none; }

/* 右下:图标栏(场景阶段把顶栏挪下来) */
body.phase-world #topbar {
  position: absolute; z-index: 30;
  top: auto; left: auto; right: 12px; bottom: 26px; height: auto; width: auto;
  padding: 6px 8px; border: 1px solid rgba(224, 184, 109, .6); border-radius: 30px;
  background: rgba(28, 20, 14, .82); box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
body.phase-world .topbar-title,
body.phase-world .topbar-sep,
body.phase-world .topbar-spacer { display: none; }
body.phase-world .topbar-btn { flex-direction: column; min-height: 0; padding: 2px 6px; gap: 2px; border: 0; color: #f2e6cc; font-size: 12px; background: transparent; }
body.phase-world .topbar-btn .icon-badge { width: 38px; height: 38px; font-size: 18px; border-radius: 50%; border: 2px solid #e0b86d; }
body.phase-world .topbar-btn:hover, body.phase-world .topbar-btn.open { color: #ffd86a; background: transparent; }
body.phase-world .topbar-dropdown { top: auto; bottom: 64px; }
body.phase-world .topbar-dropdown .topbar-btn { flex-direction: row; color: #414244; }
body.phase-world .topbar-dropdown .topbar-btn .icon-badge { width: 24px; height: 24px; font-size: 12px; }
body.phase-world .toast { top: 18%; }

/* NPC 对话菜单 */
.npc-menu { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 52; width: min(780px, calc(100% - 32px)); display: flex; align-items: flex-end; gap: 0; }
.npc-menu-face { width: 210px; height: 300px; object-fit: contain; object-position: bottom; margin-right: -26px; filter: drop-shadow(4px 6px 6px rgba(0, 0, 0, .4)); position: relative; z-index: 1; }
.npc-menu-body { flex: 1; padding: 18px 22px 14px 40px; background: rgba(255, 249, 238, .97); border-top: 3px solid #be4b30; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.npc-menu-name { color: #a53925; font-size: 21px; letter-spacing: 3px; margin-bottom: 8px; }
.npc-menu-text { color: #263f37; font-size: 17px; line-height: 1.8; margin-bottom: 10px; }
.npc-menu-options { display: flex; flex-direction: column; gap: 4px; }
.npc-menu-opt { text-align: left; font: 16px "Songti SC", serif; color: #1f4f8a; background: none; border: 0; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.npc-menu-opt:hover, .npc-menu-opt.kbd-focus { background: #f6e3bf; color: #a53925; }

/* 入战旋屏 */
.ink-swirl { position: fixed; inset: -40%; z-index: 90; pointer-events: none; background: conic-gradient(from 0deg, #120c08 0 12%, transparent 12% 25%, #120c08 25% 37%, transparent 37% 50%, #120c08 50% 62%, transparent 62% 75%, #120c08 75% 87%, transparent 87%); animation: inkSwirl 680ms ease-in forwards; }
@keyframes inkSwirl {
  0% { opacity: 0; transform: rotate(0) scale(.4); filter: blur(6px); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: rotate(320deg) scale(1.6); filter: blur(2px); background-color: #120c08; }
}

/* 升级 / 任务大字 */
.big-toast { position: absolute; left: 50%; top: 28%; transform: translate(-50%, 0); z-index: 75; pointer-events: none; text-align: center; animation: bigToast 2.4s ease forwards; }
.big-toast-title { font: bold 44px "Songti SC", serif; letter-spacing: 6px; color: #ffe066; -webkit-text-stroke: 1.5px #5a2a08; text-shadow: 0 0 18px rgba(255, 200, 60, .8), 0 4px 0 #6a2a08; }
.big-toast.quest .big-toast-title { font-size: 34px; color: #bff6ff; -webkit-text-stroke: 1.2px #0d3a4a; text-shadow: 0 0 16px rgba(120, 230, 255, .7), 0 3px 0 #0d3a4a; }
.big-toast-sub { margin-top: 8px; font-size: 17px; color: #fff6dc; text-shadow: 0 2px 4px #000; }
@keyframes bigToast {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(.8); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  20% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -24px); }
}

/* 面板补充:装备槽、商店、召唤兽资质、任务 */
.hero-gear { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.gear-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.gear-slot { color: #8a5a36; min-width: 34px; }
.gear-name.tier1 { color: #3b6b3b; }
.gear-name.tier2 { color: #1f5fb3; }
.gear-name.tier3 { color: #8a3aa8; font-weight: bold; }
.shop-row { display: grid; grid-template-columns: 120px 1fr 70px auto; gap: 10px; align-items: center; }
.shop-name { font-weight: bold; }
.shop-desc { color: #5a4a3a; font-size: 13px; }
.shop-price { color: #a8322a; }
.pet-apt { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: #5a3a1a; margin: 4px 0; }
.pet-skills { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #1f4f8a; margin-bottom: 4px; }
.quest-row { padding: 6px 0; border-bottom: 1px dashed rgba(90, 60, 30, .25); }
.quest-row-title { font-weight: bold; color: #a53925; }
.lv-growth-note.loot { color: #6a3a10; font-size: 15px; margin: 2px 0; }

/* 战斗:愤怒条(橙金,满 60 可放第一招特技时发亮) */
.bar.sp { height: 6px; }
.bar.sp .bar-fill { background: linear-gradient(180deg, #ffb347, #d0661e); }
.bar.sp .bar-ghost { background: #6a3a14; }
.bar.sp .bar-text { display: none; }
.bar.sp.ready .bar-fill { box-shadow: 0 0 6px #ffb347; }
.cmd-item.stunt .cmd-item-name { color: #b5561e; }

/* ---------- 打磨:提示的层级、HUD 不透明底、面板图标 ---------- */
/* 轻提示压在弹窗(60)之下,对白(50)之上;同一时刻只一张 */
.toast, .big-toast { z-index: 55; }
.big-toast-extra {
  margin-top: 10px; display: inline-block; padding: 6px 16px; border-radius: 16px;
  font-size: 16px; letter-spacing: 1px; color: #fff3cf; background: rgba(40, 24, 12, .78);
  border: 1px solid rgba(255, 214, 120, .6);
}
body.dlg-open .hud-hint, body.modal-open .hud-hint { display: none; }
/* 小地图、任务追踪用不透明底:传送阵字与地图不再从底下透出来 */
.hud-map, .hud-tracker { background: linear-gradient(160deg, #2b1f16, #1c140e); }
.hud-tracker { z-index: 3; }
/* 六行整高(6×20,内边距为 0):滚到底时最上一行也是完整的;一行不折,过长省略 */
.hud-chat-log { height: 120px; line-height: 20px; padding: 0 8px; margin: 5px 0; box-sizing: border-box; }
.hud-chat-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-quest-text { word-break: break-all; }
/* 背包:一格一图 + 一行说明 */
.bag-grid { gap: 14px 10px; }
.bag-item { width: 76px; padding: 4px 0; border: 0; background: none; cursor: pointer; font: inherit; }
.bag-item .icon-slot { width: 64px; height: 64px; padding: 0; background: #f6ecd6; overflow: visible; }
.bag-item .icon-slot .item-icon { width: 60px; height: 60px; }
.bag-item.on .icon-slot, .bag-item:hover .icon-slot { box-shadow: 0 0 0 2px #ae402b, 0 4px 10px rgba(0, 0, 0, .25); }
.bag-item.gear .bag-item-name { color: #1f5fb3; }
.bag-desc { min-height: 24px; margin: 8px 2px 4px; padding: 8px 12px; color: #4a3a2a; background: rgba(201, 162, 39, .1); border-left: 3px solid #ae402b; }
.gear-icon { width: 34px; height: 34px; border-radius: 6px; }
.gear-icon.empty { display: inline-flex; align-items: center; justify-content: center; color: #b8a888; border: 1px dashed #b8a888; font-size: 14px; }
.stat-btn.with-icon { display: inline-flex; align-items: center; gap: 4px; }
.shop-row { grid-template-columns: 40px 110px 1fr 64px auto; }
/* 抉择卡:整张就是按钮 */
.pick-card { width: 100%; text-align: left; font: inherit; color: inherit; }
.pick-card:hover, .pick-card.kbd-focus { border-color: var(--zhu); background: rgba(201, 162, 39, .16); box-shadow: inset 0 0 0 1px var(--zhu); }
.pick-card .pick-text { flex: 1 1 auto; min-width: 0; }
.pick-card .formation-name { white-space: nowrap; }
.pick-card .formation-desc { line-height: 1.6; }
/* 小须弥山:云雾笼住的山景,不见芭蕉洞战场 */
.story-bg.cloud-wash::after { background: linear-gradient(180deg, rgba(250, 250, 244, .72), rgba(236, 240, 232, .55) 55%, rgba(210, 222, 214, .7)); }
/* 结局主视觉:雨后火口上淡入,回顾卡靠左 */
.ending-art { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease; }
.ending-art.in { opacity: 1; }
.ending-root:has(.ending-art) { justify-content: flex-start; }
.ending-root:has(.ending-art) .ending-panel { margin-left: 4%; width: 36%; max-height: 88%; overflow: auto; padding: 22px 26px; }
.ending-root:has(.ending-art) .ending-title { font-size: 20px; letter-spacing: 3px; white-space: nowrap; }
/* 碧波潭布景:殿柱旁拴着金睛兽,螃蟹从暗处横过来 */
.bibotan-pixie { position: absolute; right: 9%; bottom: 8%; height: 58%; filter: brightness(.8) saturate(.85) drop-shadow(0 10px 12px rgba(0, 20, 40, .5)); }
.bibotan-crab { position: absolute; left: -24%; bottom: 4%; height: 30%; opacity: 0; transition: left 1.8s ease, opacity .6s ease; filter: drop-shadow(0 8px 10px rgba(0, 20, 40, .5)); }
.bibotan-root.crab-in .bibotan-crab { left: 12%; opacity: 1; }
.bibotan-root.crab-near .bibotan-crab { left: 46%; }
.bibotan-root.freed .bibotan-crab { left: 60%; opacity: 0; }
.dlg-name[hidden] { display: none; }

/* 窄屏:只留头像、追踪与图标栏,小地图与聊天让位给画面(未做实机验收) */
@media (max-width: 700px) {
  .hud-map .hud-minimap, .hud-chat, .hud-card.pet { display: none; }
  .hud-map { padding: 4px 8px; }
  .hud-card-info { width: 120px; }
  .hud-face { width: 44px; height: 44px; }
  .hud-tracker { top: auto; bottom: 96px; left: 12px; right: 12px; width: auto; }
  body.phase-world #topbar { left: 8px; right: 8px; bottom: 22px; justify-content: space-around; }
  body.phase-world .topbar-btn .icon-badge { width: 32px; height: 32px; font-size: 15px; }
  .npc-menu-face { width: 120px; height: 180px; }
  .hud-hint { top: 76px; width: calc(100% - 24px); font-size: 13px; border-radius: 12px; }
  body.phase-world .topbar-btn { white-space: nowrap; font-size: 11px; padding: 2px 3px; }
}
