  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { width: 100%; height: 100%; overflow: hidden; background:
      radial-gradient(circle at 50% 30%, #1a2340 0%, #0d1226 45%, #05050a 100%);
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif; color: #fff; user-select: none; cursor: default; }
  body { display: flex; align-items: center; justify-content: center; }
  /* 全屏游戏区：铺满整个浏览器窗口 */
  #app {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }
  #game-container { position: absolute; inset: 0; }
  canvas { display: block; }
  /* 兜底：3D 画布永远铺满游戏区，避免窗口尺寸变化后画布停在旧尺寸被居中裁切 */
  #game-container > canvas { width: 100% !important; height: 100% !important; }

  #status-bar {
    position: absolute; top: 8px; left: 8px; right: 8px;
    display: flex; flex-wrap: wrap; gap: 6px;
    background: rgba(0,0,0,0.5); padding: 6px 10px; border-radius: 8px;
    font-size: 12px; pointer-events: none; z-index: 10;
    border: 1px solid rgba(255,255,255,0.15);
  }
  /* 任务追踪 HUD：位于状态栏下方，常驻显示当前任务 */
  .task-hud {
    position: absolute; top: 62px; left: 8px; right: 8px;
    display: flex; flex-direction: column; gap: 2px;
    background: linear-gradient(90deg, rgba(20,40,30,0.72), rgba(20,40,30,0.25));
    padding: 7px 12px; border-radius: 8px;
    font-size: 12px; pointer-events: none; z-index: 10;
    border-left: 3px solid #ffd966;
    transition: opacity 0.3s;
  }
  .task-hud-name { color: #ffd966; font-weight: bold; font-size: 13px; }
  .task-hud-goal { color: #cfd8c4; }
  .task-hud-help { color: #8fae96; font-size: 10px; letter-spacing: .5px; }
  /* 委托簿：当前/主线/旁事/已结 */
  #quest-panel { max-width: 760px; width: 94%; max-height: 86vh; display: flex; flex-direction: column; }
  #quest-current { margin-bottom: 8px; }
  .quest-columns { display: flex; gap: 12px; flex: 1; min-height: 0; }
  .quest-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .quest-column h3, .quest-done-title { color: #ffd966; font-size: 14px; margin: 8px 0 6px; }
  #quest-main, #quest-side { flex: 1; overflow: auto; padding-right: 4px; }
  #quest-done { max-height: 110px; overflow: auto; }
  .quest-row { background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.10); border-left: 3px solid #5a5068; border-radius: 6px; padding: 7px 9px; margin-bottom: 6px; }
  .quest-row.quest-current { background: rgba(255,217,102,0.10); border-color: #ffd966; }
  .quest-row.quest-available { border-left-color: #66ff88; }
  .quest-row.quest-locked { opacity: .62; }
  .quest-row.quest-done { opacity: .58; border-left-color: #555; }
  .quest-row-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
  .quest-name { color: #ffd966; font-size: 13px; font-weight: bold; }
  .quest-tag { color: #9fd6a8; font-size: 10px; border: 1px solid rgba(159,214,168,.35); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
  .quest-row.quest-done .quest-tag { color: #999; border-color: #555; }
  .quest-meta { color: #8f8a9a; font-size: 10px; margin-top: 3px; }
  .quest-goal { color: #d8d4c8; font-size: 12px; line-height: 1.5; margin-top: 3px; }
  .quest-start { margin-top:8px; padding:8px 10px; color:#cfc7ff; background:rgba(90,70,150,.18); border-left:2px solid #8a5cf6; line-height:1.65; }
  .quest-reward { color: #c9a85a; font-size: 10px; margin-top: 2px; }
  .quest-empty { color: #8f8a9a; font-size: 11px; line-height: 1.6; padding: 6px 2px; }
  #status-bar .item { background: rgba(60,80,60,0.6); padding: 3px 7px; border-radius: 4px; white-space: nowrap; }
  #status-bar .item b { color: #ffd966; }
  #status-bar .scene-tag { background: rgba(80,40,120,0.7); }
  /* 主角经验条：贴在状态栏底部，和宠物那条同色系 */
  #player-exp-track { position: absolute; left: 10px; right: 10px; bottom: 1px; height: 3px; background: rgba(0,0,0,0.55); border-radius: 2px; overflow: hidden; }
  #player-exp-fill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg,#7fd6ff,#4aa8ff); border-radius: 2px; transition: width .2s ease-out; }

  #player-hp { position: absolute; bottom: 14px; left: 14px; width: 280px; z-index: 10; pointer-events: none; }
  #player-hp .label { font-size: 12px; color: #ddd; margin-bottom: 3px; text-shadow: 0 1px 2px #000; }
  .hp-bar { height: 16px; background: #300; border-radius: 8px; overflow: hidden; border: 1px solid #500; box-shadow: 0 0 6px rgba(0,0,0,0.6); }
  .hp-fill { height: 100%; background: linear-gradient(90deg, #e44, #f76); transition: width 0.3s; }
  .hp-fill.low { background: linear-gradient(90deg, #f33, #f55); }
  .st-bar { height: 7px; margin-top: 3px; background: #1a2a1a; border-radius: 4px; overflow: hidden; border: 1px solid #2a4a2a; }
  .st-fill { height: 100%; background: linear-gradient(90deg, #7ddc72, #b8ef6a); transition: width 0.12s linear; }
  .st-fill.low { background: linear-gradient(90deg, #d8a63a, #e8c24a); }
  #player-hp .sub { font-size: 11px; color: #aaa; margin-top: 3px; }

  #skill-bar { position: absolute; bottom: 14px; right: 14px; display: flex; gap: 8px; z-index: 10; pointer-events: none; }
  .skill-slot {
    width: 56px; height: 56px; background: rgba(0,0,0,0.6); border: 2px solid #6b8ad8;
    border-radius: 8px; position: relative; text-align: center; line-height: 56px;
    font-size: 11px; color: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.6);
  }
  .skill-slot .icon { font-size: 20px; }
  .skill-slot .key { position: absolute; bottom: 2px; right: 4px; font-size: 10px; color: #ffd966; }
  .skill-slot .cd-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.65); border-radius: 6px; display: none; line-height: 56px; font-size: 14px; }
  .skill-slot.cooling .cd-mask { display: block; }
  .skill-slot.unlocked { border-color: #ffd966; box-shadow: 0 0 8px rgba(255,217,102,0.4); }
  /* 无敌槽位：允许鼠标点击（#skill-bar 整体 pointer-events:none），开启时整格泛绿光 */
  .skill-slot.god { pointer-events: auto; cursor: pointer; opacity: 0.72; }
  .skill-slot.god.god-on {
    opacity: 1; border-color: #46f58a;
    background: rgba(18,64,38,0.78);
    box-shadow: 0 0 12px rgba(70,245,138,0.65) inset, 0 0 10px rgba(70,245,138,0.45);
  }

  #crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; pointer-events: none; z-index: 8; opacity: 0.8; }
  #crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
  #crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
  #crosshair::after { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }

  #damage-flash { position: absolute; inset: 0; pointer-events: none; z-index: 9; background: radial-gradient(ellipse at center, transparent 30%, rgba(255,0,0,0.7) 100%); opacity: 0; transition: opacity 0.4s; }
  #damage-flash.hit { opacity: 0.7; transition: none; }

  #lock-hint { position: absolute; top: 52%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.7); padding: 14px 26px; border-radius: 10px; font-size: 15px; color: #ffe08a; z-index: 11; pointer-events: none; display: none; border: 1px solid rgba(255,224,138,0.4); text-align: center; }
  #lock-hint.show { display: block; }

  .enemy-hp-bar { position: absolute; width: 80px; height: 6px; background: #400; border-radius: 3px; border: 1px solid #800; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; display: none; }
  .enemy-hp-bar .fill { height: 100%; background: linear-gradient(90deg, #f44, #f86); border-radius: 3px; }
  .enemy-hp-bar.boss { width: 240px; height: 10px; }
  .enemy-hp-bar.boss .fill { background: linear-gradient(90deg, #c33, #f55); }
  .enemy-hp-bar.elite .fill { background: linear-gradient(90deg, #ffd700, #ffaa00); }
  /* 收招硬直窗口提示：血条描边轻闪，告诉玩家现在可以放心反打 */
  .enemy-hp-bar.counterable { border-color: #ffd966; box-shadow: 0 0 0 1px rgba(255,217,102,0.85), 0 0 8px rgba(255,217,102,0.5); animation: hpCounterBlink 0.36s steps(2, end) infinite; }
  @keyframes hpCounterBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
  /* Boss 顶部血条：屏幕中上方固定，加粗，带名字；只在玩家开战后显示 */
  #boss-hud { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); width: min(620px, 78vw); z-index: 8; pointer-events: none; display: none; text-align: center; }
  #boss-hud .boss-hud-name { font-size: 15px; font-weight: 700; letter-spacing: 2px; color: #ffe7c4; text-shadow: 0 2px 4px #000, 0 0 10px rgba(255,90,60,.7); margin-bottom: 5px; }
  #boss-hud .boss-hud-track { height: 20px; background: rgba(20,6,6,.85); border: 2px solid #a33; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.7), inset 0 0 6px rgba(0,0,0,.8); }
  #boss-hud .boss-hud-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #8b1414, #e33 55%, #ff6a4a); transition: width .18s ease-out; }
  #boss-hud .boss-hud-fill.low { background: linear-gradient(90deg, #a00, #f33); }
  #boss-hud-status { text-align:center; color:#ffd966; font-weight:bold; margin-top:4px; }
  #boss-hud-status.recover { color:#66ff99; }

  #pause-keymap { margin-top: 14px; text-align: left; font-size: 11px; line-height: 2; color: #bbb; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; padding: 8px 10px; }
  #pause-keymap b { color: #ffd966; display: block; margin-bottom: 4px; font-size: 12px; }
  #pause-keymap kbd { background: #444; padding: 1px 5px; border-radius: 3px; color: #fff; margin: 0 1px; font-size: 10px; }

  #interact-hint { position: absolute; top: 58%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.7); padding: 8px 16px; border-radius: 6px; font-size: 14px; color: #ffe08a; z-index: 11; pointer-events: none; display: none; border: 1px solid rgba(255,224,138,0.4); }
  #interact-hint.show { display: block; }

  #message { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.75); color: #ffe08a; padding: 8px 18px; border-radius: 6px; font-size: 14px; z-index: 60; opacity: 0; transition: opacity 0.3s; border: 1px solid rgba(255,224,138,0.4); pointer-events: none; max-width: 80%; text-align: center; }
  #message.show { opacity: 1; }
#voice-subtitle { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); max-width: 70%; padding: 8px 18px; background: rgba(0,0,0,0.55); color: #fff; font-size: 16px; border-radius: 8px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 30; text-align: center; line-height: 1.4; }
#voice-subtitle.show { opacity: 1; }
#fairy-bubble { position: absolute; left: 20px; bottom: 130px; max-width: 46%; padding: 10px 14px; background: rgba(40,20,70,0.72); color: #ffe9ff; font-size: 15px; border-radius: 12px 12px 12px 2px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 30; line-height: 1.45; border: 1px solid rgba(200,150,255,0.4); }
#fairy-bubble.show { opacity: 1; }
#fairy-panel {
  position: absolute; right: 14px; bottom: 90px; z-index: 31;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 6px;
}
#fairy-mini {
  width: 36px; height: 36px; border-radius: 50%; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.62); color: #ddd; font-size: 17px;
  border: 1px solid rgba(200,150,255,0.45); cursor: pointer;
  font-family: inherit; transition: background .15s, border-color .15s;
}
#fairy-mini:hover { background: rgba(60,40,100,0.82); border-color: rgba(200,150,255,0.78); }
#fairy-body {
  display: none; flex-direction: column; gap: 4px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(0,0,0,0.62); border: 1px solid rgba(200,150,255,0.3);
  color: #ddd; font-size: 12px; min-width: 132px;
}
#fairy-panel.open #fairy-body { display: flex; }
#fairy-body label { cursor: pointer; }
#fairy-body button { cursor: pointer; margin-top: 4px; }

  /* 连击显示 */
  #combo-display { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); z-index: 10; pointer-events: none; opacity: 0; transition: opacity 0.3s; text-align: right; }  #combo-display.show { opacity: 1; }
  #combo-display .combo-num { font-size: 42px; font-weight: bold; color: #ffd966; text-shadow: 0 0 12px rgba(255,217,102,0.7), 2px 2px 0 #000; line-height: 1; }
  #combo-display .combo-label { font-size: 14px; color: #ff8866; text-shadow: 1px 1px 0 #000; }
  #combo-display .combo-bonus { font-size: 12px; color: #88ff88; text-shadow: 1px 1px 0 #000; }

  /* 子弹时间提示 */
  #bullet-time-flash { position: absolute; inset: 0; pointer-events: none; z-index: 8; background: radial-gradient(ellipse at center, transparent 40%, rgba(100,150,255,0.3) 100%); opacity: 0; transition: opacity 0.2s; }
  #bullet-time-flash.active { opacity: 1; }
  #bullet-time-label { position: absolute; top: 35%; left: 50%; transform: translate(-50%, -50%); font-size: 28px; font-weight: bold; color: #88ccff; text-shadow: 0 0 16px rgba(100,180,255,0.8), 2px 2px 0 #000; z-index: 12; pointer-events: none; display: none; }
  #bullet-time-label.show { display: block; animation: bulletTimePulse 0.5s; }
  @keyframes bulletTimePulse { 0%{transform:translate(-50%,-50%) scale(0.5);opacity:0;} 50%{transform:translate(-50%,-50%) scale(1.2);opacity:1;} 100%{transform:translate(-50%,-50%) scale(1);opacity:1;} }

  /* 完美闪避提示 */
  #perfect-dodge-label { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 26px; font-weight: bold; color: #ffdd44; text-shadow: 0 0 14px rgba(255,221,68,0.8), 2px 2px 0 #000; z-index: 12; pointer-events: none; display: none; }
  #perfect-dodge-label.show { display: block; animation: dodgePulse 1s; }
  @keyframes dodgePulse { 0%{transform:translate(-50%,-50%) scale(0.3);opacity:0;} 20%{transform:translate(-50%,-50%) scale(1.3);opacity:1;} 80%{opacity:1;} 100%{opacity:0;} }

  /* 技能树面板 */
  #skill-tree-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.85); z-index: 48; display: flex; align-items: center; justify-content: center; }
  #skill-tree-overlay.hidden { display: none; }
  #skill-tree-panel { background: linear-gradient(180deg, #2a2438 0%, #1a1428 100%); border: 2px solid #6b4ea0; border-radius: 12px; padding: 24px; max-width: 560px; width: 90%; max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(120,80,200,0.4); }
  #st-list { flex: 1; overflow-y: auto; padding-right: 6px; }
  #st-list::-webkit-scrollbar { width: 8px; }
  #st-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
  #st-list::-webkit-scrollbar-thumb { background: #6b4ea0; border-radius: 4px; }
  #st-list::-webkit-scrollbar-thumb:hover { background: #8a6bd0; }
  #skill-tree-panel h2 { color: #ffd966; text-align: center; font-size: 22px; margin-bottom: 6px; }
  #skill-tree-panel .sub { text-align: center; color: #aaa; font-size: 13px; margin-bottom: 14px; }
  .skill-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 8px 0; background: rgba(0,0,0,0.3); border: 2px solid #444; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
  .skill-card:hover:not(.locked):not(.learned) { border-color: #ffd966; filter: brightness(1.3); }
  .skill-card.learned { border-color: #66ff66; background: rgba(40,80,40,0.4); cursor: default; }
  .skill-card.locked { opacity: 0.4; cursor: not-allowed; }
  .skill-card .skill-icon { font-size: 28px; width: 40px; text-align: center; }
  .skill-card .skill-info { flex: 1; }
  .skill-card .skill-info .n { font-weight: bold; color: #ffd966; font-size: 14px; }
  .skill-card .skill-info .d { font-size: 12px; color: #aaa; }
  .skill-card .skill-status { font-size: 12px; color: #888; }
  .skill-card.learned .skill-status { color: #66ff66; }

  /* 世界地图 */
  #worldmap-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.88); z-index: 48; display: flex; align-items: center; justify-content: center; }
  #worldmap-overlay.hidden { display: none; }
  #worldmap-panel { background: linear-gradient(180deg, #2a2438 0%, #1a1428 100%); border: 2px solid #6b4ea0; border-radius: 12px; padding: 20px; max-width: 520px; width: 90%; max-height: 85vh; box-shadow: 0 0 40px rgba(120,80,200,0.4); }
  #worldmap-panel h2 { color: #ffd966; text-align: center; font-size: 20px; margin-bottom: 4px; }
  #worldmap-panel .sub { text-align: center; color: #aaa; font-size: 12px; margin-bottom: 12px; }
  #worldmap-canvas { width: 100%; background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px solid #444; }
  .wm-scene-dot { cursor: default; }
  .wm-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 11px; color: #aaa; }
  .wm-legend span { display: flex; align-items: center; gap: 4px; }
  .wm-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

  /* 传送阵 */
  #teleport-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.88); z-index: 49; display: flex; align-items: center; justify-content: center; }
  #teleport-overlay.hidden { display: none; }
  #teleport-panel { background: linear-gradient(180deg, #1a2438 0%, #0f1626 100%); border: 2px solid #3d6bd4; border-radius: 12px; padding: 20px; max-width: 520px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 0 40px rgba(60,120,230,0.45); }
  #teleport-panel h2 { color: #7fb2ff; text-align: center; font-size: 20px; margin-bottom: 4px; }
  #teleport-panel .sub { text-align: center; color: #aaa; font-size: 12px; margin-bottom: 12px; }
  .tp-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 6px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
  .tp-item .nm { font-weight: bold; color: #eef; font-size: 14px; }
  .tp-item .rg { color: #8ab; font-size: 11px; margin-top: 2px; }
  .tp-item .cur { color: #7fb2ff; font-size: 12px; margin-right: 8px; }
  .tp-item.locked { opacity: 0.45; }
  .tp-item.locked .nm { color: #888; }

  /* 剧情对话框 */
  #dialogue-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.85) 30%); padding: 30px 40px 20px; z-index: 30; display: none; }
  #dialogue-overlay.show { display: block; }
  #dialogue-box { background: rgba(0,0,0,0.8); border: 2px solid #6b4ea0; border-radius: 10px; padding: 18px 24px; max-width: 600px; margin: 0 auto; }
  #dialogue-speaker { color: #ffd966; font-size: 15px; font-weight: bold; margin-bottom: 8px; }
  #dialogue-text { color: #ddd; font-size: 14px; line-height: 1.8; min-height: 40px; }
  #dialogue-hint { text-align: right; color: #888; font-size: 12px; margin-top: 8px; }

  .overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; z-index: 50; }
  .overlay.hidden { display: none; }
  /* ===== 加载遮罩：进入游戏时盖住屏幕，纯 CSS 动画，进度条由 JS 推进 ===== */
  .loading-overlay { position: absolute; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 45%, #241a3a 0%, #120d1e 55%, #080610 100%); }
  .loading-overlay.hidden { display: none; }
  .loading-overlay.fade-out { animation: loadingFadeOut 0.42s ease forwards; }
  @keyframes loadingFadeOut { from { opacity: 1; } to { opacity: 0; } }
  .loading-core { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 78%; max-width: 340px; }
  /* 双层符文环：外环顺时针、内环逆时针，中心剑徽缓慢脉动 */
  .loading-sigil { position: relative; width: 96px; height: 96px; margin-bottom: 4px; }
  .loading-sigil::before, .loading-sigil::after { content: ''; position: absolute; border-radius: 50%; }
  .loading-sigil::before { inset: 0; border: 2px solid rgba(140,110,220,0.18); border-top-color: #b98cff;
    border-right-color: #7a5fd0; box-shadow: 0 0 22px rgba(150,110,240,0.28); animation: sigilSpin 1.5s linear infinite; }
  .loading-sigil::after { inset: 14px; border: 2px dashed rgba(255,217,102,0.22); border-bottom-color: #ffd966;
    animation: sigilSpinRev 2.2s linear infinite; }
  .loading-sigil-inner { position: absolute; inset: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #ffd966; text-shadow: 0 0 14px rgba(255,217,102,0.65); animation: sigilPulse 1.6s ease-in-out infinite; }
  @keyframes sigilSpin { to { transform: rotate(360deg); } }
  @keyframes sigilSpinRev { to { transform: rotate(-360deg); } }
  @keyframes sigilPulse { 0%,100% { opacity: 0.55; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.08); } }
  .loading-title { color: #ffd966; font-size: 21px; font-weight: bold; letter-spacing: 6px; text-shadow: 0 0 18px rgba(255,217,102,0.4); }
  .loading-stage { color: #cfc7ff; font-size: 13px; min-height: 18px; letter-spacing: 1px; }
  .loading-track { position: relative; width: 100%; height: 7px; border-radius: 5px; overflow: hidden;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(150,120,220,0.3); }
  .loading-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 40%;
    background: linear-gradient(90deg, transparent, #6b4ea0 25%, #b98cff 60%, #ffd966 88%, transparent);
    box-shadow: 0 0 12px rgba(185,140,255,0.55);
    /* 不确定进度：扫描条来回滑动，纯 CSS 合成器动画，主线程阻塞时也照常动 */
    animation: loadingSweep 1.25s ease-in-out infinite; }
  @keyframes loadingSweep { 0% { left: -40%; } 100% { left: 100%; } }
  .loading-tip { color: #7d7596; font-size: 11px; letter-spacing: 2px; }
  .panel { background: linear-gradient(180deg, #2a2438 0%, #1a1428 100%); border: 2px solid #6b4ea0; border-radius: 12px; padding: 24px; max-width: 520px; width: 90%; box-shadow: 0 0 40px rgba(120,80,200,0.4); }
  .panel h2 { color: #ffd966; margin-bottom: 12px; text-align: center; font-size: 22px; }
  .panel p { color: #ddd; margin: 6px 0; line-height: 1.6; font-size: 13px; }
  .btn { background: linear-gradient(180deg, #4a6bb8 0%, #2e4a8c 100%); color: #fff; border: 1px solid #6b8ad8; border-radius: 6px; padding: 10px 18px; font-size: 14px; cursor: pointer; transition: filter 0.15s; margin: 4px; font-family: inherit; }
  .btn.small { padding: 6px 12px; font-size: 13px; margin: 2px; }
  .btn:hover:not(:disabled) { filter: brightness(1.2); }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .btn.gold { background: linear-gradient(180deg, #b8941f 0%, #8a6f15 100%); border-color: #d4af37; }
  .btn.danger { background: linear-gradient(180deg, #b84a4a 0%, #8c2e2e 100%); border-color: #d86b6b; }
  .btn.green { background: linear-gradient(180deg, #4ab85a 0%, #2e8c3a 100%); border-color: #6bd87b; }

  #shop-panel { max-width: 480px; max-height: calc(100vh - 40px); overflow-y: auto; }
  .shop-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; margin: 6px 0; background: rgba(0,0,0,0.3); border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); }
  .shop-item .info { flex: 1; }
  .shop-item .info .n { font-weight: bold; color: #ffd966; }
  .shop-item .info .d { font-size: 11px; color: #aaa; }
  .shop-item .price { color: #d4af37; margin: 0 10px; font-size: 13px; }
  .shop-item .price.discount { text-decoration: line-through; color: #888; }
  .shop-item .price-real { color: #ff6644; margin: 0 10px; font-size: 13px; }

  #start-panel, #end-panel, #end-panel-victory { text-align: center; max-width: 500px; }
  /* 开始界面自适应矮屏：面板限高到视口内，内容超高时自身滚动，保证底部账号/按钮不被截断 */
  #start-overlay { padding: 12px 0; }
  #start-panel { max-height: calc(100vh - 24px); overflow-y: auto; box-sizing: border-box; }
  #start-panel .story { max-height: 34vh; overflow-y: auto; flex: none; }
  /* 序章在矮屏下缩小留白，给账号/按钮腾空间 */
  @media (max-height: 760px) {
    #start-panel { padding: 14px 20px; }
    #start-panel h1 { font-size: 24px; }
    #start-panel .subtitle { margin-bottom: 10px; }
    #start-panel .story { max-height: 26vh; line-height: 1.6; padding: 8px 10px; margin-bottom: 10px; }
    #account-box { margin-top: 8px !important; padding-top: 8px !important; }
    #audio-box { margin-top: 6px !important; padding-top: 6px !important; }
  }
  #start-panel h1 { color: #ffd966; font-size: 30px; margin-bottom: 6px; text-shadow: 0 0 20px rgba(255,217,102,0.5); }
  #start-panel .subtitle { color: #a8c0ff; margin-bottom: 18px; font-size: 13px; }
  #start-panel .story { color: #ccc; font-size: 12px; line-height: 1.8; margin-bottom: 18px; text-align: left; background: rgba(0,0,0,0.3); padding: 12px; border-radius: 6px; }
  .btn-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
  .account-input { background: #241a3a; color: #fff; border: 1px solid #6b4ea0; border-radius: 5px; padding: 6px 8px; font-size: 13px; font-family: inherit; }
  .account-input:focus { outline: none; border-color: #a97bff; }

  #puzzle-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.82); z-index: 45; display: flex; align-items: center; justify-content: center; }
  #puzzle-overlay.hidden { display: none; }
  #puzzle-panel { background: linear-gradient(180deg, #2a1f3a 0%, #15102a 100%); border: 2px solid #8a6bd0; border-radius: 14px; padding: 22px; max-width: 520px; width: 92%; box-shadow: 0 0 36px rgba(140,100,220,0.5); }
  #puzzle-panel h2 { color: #c8a8ff; text-align: center; font-size: 20px; margin-bottom: 8px; }
  #puzzle-panel .desc { color: #c9b8e0; font-size: 12px; text-align: center; margin-bottom: 14px; line-height: 1.6; white-space: pre-line; }
  #puzzle-area { margin: 12px 0; min-height: 100px; }
  .puzzle-rune-grid, .puzzle-stele-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 360px; margin: 0 auto; }
  .puzzle-cell { background: linear-gradient(180deg, #3a2e5a 0%, #241a3a 100%); border: 2px solid #6b4ea0; border-radius: 8px; padding: 14px 6px; cursor: pointer; text-align: center; font-size: 16px; color: #ffe08a; transition: all 0.15s; user-select: none; }
  .puzzle-cell:hover { border-color: #ffd966; filter: brightness(1.3); }
  .puzzle-cell.activated { background: linear-gradient(180deg, #b8941f 0%, #8a6f15 100%); color: #fff; border-color: #ffd966; }
  .puzzle-cell.wrong { background: linear-gradient(180deg, #b84a4a 0%, #8c2e2e 100%); border-color: #ff6666; animation: shake 0.4s; }
  .puzzle-sequence { text-align: center; margin: 10px 0; font-size: 13px; color: #aaa; min-height: 20px; }
  .puzzle-sequence b { color: #ffd966; margin: 0 4px; }
  .puzzle-rings { display: flex; justify-content: center; gap: 20px; margin: 16px 0; }
  .puzzle-ring-wrap { text-align: center; }
  .puzzle-ring { width: 90px; height: 90px; border-radius: 50%; border: 4px solid #6b4ea0; background: conic-gradient(from 0deg, #4a3a6a, #6b4ea0, #4a3a6a, #6b4ea0, #4a3a6a); position: relative; cursor: pointer; transition: transform 0.25s; }
  .puzzle-ring .mark { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 8px; height: 8px; background: #ffd966; border-radius: 50%; box-shadow: 0 0 8px #ffd966; }
  .puzzle-ring.aligned { border-color: #66ff66; box-shadow: 0 0 16px rgba(100,255,100,0.6); }
  .puzzle-ring-wrap .label { font-size: 11px; color: #aaa; margin-top: 6px; }
  .puzzle-controls { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }

  @keyframes shake { 0%,100%{transform:translateX(0);} 20%{transform:translateX(-6px);} 40%{transform:translateX(6px);} 60%{transform:translateX(-4px);} 80%{transform:translateX(4px);} }
  @keyframes screenShake { 0%,100%{transform:translate(0,0);} 25%{transform:translate(-8px,4px);} 50%{transform:translate(8px,-4px);} 75%{transform:translate(-4px,8px);} }
  #game-container.shake { animation: screenShake 0.4s; }

  #success-flash { position: absolute; inset: 0; pointer-events: none; z-index: 40; background: radial-gradient(ellipse at center, rgba(255,215,0,0.5) 0%, transparent 60%); opacity: 0; transition: opacity 0.6s; }
  #success-flash.show { opacity: 1; }
  #particle-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 41; }
/* 列表容器滚动条 */
#bag-panel, #shop-list, #shop-sell-list, #shop-equip-panel, #st-list, #achv-list, #codex-panel {
  overflow-y: auto;
  max-height: 58vh;
}
/* ⑤ 背包里多了合成区，三栏 + 合成区需要更高的可视高度，否则合成区被挤出画面 */
#bag-panel { max-height: 82vh; }

/* ===== 宠物栏 ===== */
#pet-panel {
  position: absolute; left: 14px; top: 128px; width: 208px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; z-index: 12;
  background: linear-gradient(180deg, rgba(24,28,38,0.82), rgba(12,15,22,0.88));
  border: 1px solid rgba(255,208,138,0.42); border-radius: 9px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.45);
  font-family: "Microsoft YaHei", sans-serif;
}
#pet-lv {
  font-size: 11px; font-weight: 700; letter-spacing: .3px; line-height: 1;
  color: #ffd08a; padding: 4px 6px; border-radius: 5px; white-space: nowrap;
  background: rgba(255,208,138,0.12); border: 1px solid rgba(255,208,138,0.38);
  font-variant-numeric: tabular-nums;
}
/* 面板左上角的「宠物」小标签，标明这一栏是宠物而非玩家/NPC */
#pet-panel::before {
  content: "宠物";
  position: absolute; top: -9px; left: 10px;
  font-size: 9px; line-height: 1; letter-spacing: 1px;
  color: #ffd08a; padding: 2px 5px; border-radius: 3px;
  background: rgba(20,24,32,0.95);
  border: 1px solid rgba(255,208,138,0.45);
}
.pet-meta { flex: 1; min-width: 0; }
.pet-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 5px; }
#pet-name { font-size: 12px; color: #ffd08a; font-weight: 600; letter-spacing: .5px; white-space: nowrap; }
#pet-hp-text { font-size: 10px; color: #b9c6d8; font-variant-numeric: tabular-nums; }
.pet-hp-bar { height: 7px; background: #241f19; border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,208,138,0.22); }
#pet-hp-fill { display: block; height: 100%; width: 100%; border-radius: 3px; background: linear-gradient(90deg,#ffd08a,#ffb347); transition: width .18s ease-out; }
.pet-exp-bar { height: 3px; margin-top: 4px; background: #1b2230; border-radius: 2px; overflow: hidden; }
#pet-exp-fill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg,#7fd6ff,#4aa8ff); border-radius: 2px; transition: width .18s ease-out; }
#pet-btn {
  font-size: 11px; padding: 5px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  background: #3a2f22; color: #ffd08a; border: 1px solid rgba(255,208,138,0.5);
  font-family: inherit; transition: background .15s;
}
#pet-btn:hover { background: #4e3f2d; }
#pet-panel.pet-tired { border-color: rgba(201,154,85,0.6); }
#pet-panel.pet-tired #pet-name { color: #c99a55; }
#pet-panel.pet-tired #pet-lv { filter: grayscale(0.6); }
