/* ==========================================================================
   《从史莱姆到宇宙深空》 (Slime to Cosmos: Incremental RPG)
   美术风格：蚀刻羊皮纸与星金微光绘本 (Luminous Grimoire & Astral Engraving)
   ========================================================================== */

:root {
  /* 调色板基准 */
  --bg-dark-abyss: #0c0a09;
  --bg-parchment-deep: #161210;
  --bg-parchment-card: #1f1916;
  --bg-parchment-light: #2c2420;
  
  --border-gold-dim: #5c4733;
  --border-gold-bright: #d4af37;
  --gold-leaf: #f6c85f;
  --gold-glow: rgba(246, 200, 95, 0.45);
  --gold-amber: #f59e0b;
  
  --star-cyan: #38bdf8;
  --star-purple: #c084fc;
  --star-cosmic: #f472b6;
  
  --ruby-cinnabar: #c8382e;
  --ruby-bright: #ef4444;
  
  --text-main: #f5eee6;
  --text-dim: #baa99c;
  --text-gold: #f6c85f;
  --text-star: #38bdf8;

  /* 触控热区与多端度量 */
  --touch-min: 44px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --font-serif: "Cinzel", "Palatino Linotype", "Book Antiqua", "Songti SC", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark-abyss);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.4;
  font-size: 13px;
  position: fixed;
  inset: 0;
}

/* 主游戏容器 (动态视口自适应) */
#game-container {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #1e1713 0%, #0c0a09 100%);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   1. 顶部 HUD 全息状态栏
   ========================================================================== */
#top-hud {
  height: 54px;
  min-height: 54px;
  width: 100%;
  background: linear-gradient(180deg, rgba(31, 25, 22, 0.98) 0%, rgba(18, 14, 12, 0.92) 100%);
  border-bottom: 1px solid var(--border-gold-dim);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 20;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.realm-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(12, 10, 9, 0.7);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold-dim);
}

.hud-icon {
  width: 18px;
  height: 18px;
}

.compass-spin {
  animation: spinSlow 30s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.realm-name {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-gold);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.wave-info {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(28, 25, 23, 0.6);
  padding: 3px 8px;
  border-radius: 4px;
}

.wave-info span {
  color: #fff;
  font-weight: 700;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currency-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(12, 10, 9, 0.85);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold-dim);
}

.gold-badge {
  border-color: rgba(245, 208, 97, 0.5);
}

.star-badge {
  border-color: rgba(56, 189, 248, 0.5);
}

.btn-hud-reset {
  background: rgba(60, 20, 20, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}

.btn-hud-reset:hover {
  background: rgba(185, 28, 28, 0.85);
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.currency-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.currency-content {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.currency-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.currency-value {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-serif);
}

.gold-badge .currency-value {
  color: var(--text-gold);
}

.star-badge .currency-value {
  color: var(--text-star);
}

/* ==========================================================================
   2. 主战术多栏工作台架构
   ========================================================================== */
#main-tactical-board {
  flex: 1;
  width: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
}

.tactical-col {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-parchment-deep);
  padding: 12px;
  gap: 12px;
}

/* 滚动条美化 */
.tactical-col::-webkit-scrollbar {
  width: 5px;
}
.tactical-col::-webkit-scrollbar-thumb {
  background: var(--border-gold-dim);
  border-radius: 4px;
}

/* 栏目头部 */
.panel-header {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(92, 71, 51, 0.35);
  padding-bottom: 6px;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-gold);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.panel-sub {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==========================================================================
   3. 左栏：英雄属性概览与加点树
   ========================================================================== */
.col-left {
  width: 320px;
  min-width: 300px;
  border-right: 1px solid rgba(92, 71, 51, 0.4);
}

.char-summary-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.char-avatar-box {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle, #3d2f24 0%, #161210 100%);
  border: 1px solid var(--border-gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-portrait-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.char-rank-tag {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--border-gold-bright);
  color: #1a1410;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.char-stats-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.char-equipped-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(18, 14, 12, 0.85);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.equip-slot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(45, 34, 25, 0.4);
  border: 1px dashed rgba(212, 163, 89, 0.3);
  border-radius: 4px;
  padding: 4px;
  text-align: center;
}

.slot-type-label {
  font-size: 9px;
  color: var(--accent-gold);
  font-weight: 700;
  text-transform: uppercase;
}

.slot-item-name {
  font-size: 10px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-cell {
  font-size: 11px;
  color: var(--text-dim);
}

.stat-num {
  font-weight: 700;
  color: #fff;
  font-family: var(--font-serif);
}

/* 升级项列表与质变卡片 */
.tree-category-title {
  font-size: 12px;
  color: var(--text-gold);
  font-weight: 700;
  border-left: 3px solid var(--border-gold-bright);
  padding-left: 6px;
  margin-bottom: 6px;
}

.upgrades-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-row {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.2s;
}

.upgrade-row:hover {
  border-color: var(--border-gold-bright);
}

.up-info {
  flex: 1;
}

.up-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.up-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 12px;
}

.up-badge {
  font-size: 10px;
  color: var(--text-gold);
  background: rgba(246, 200, 95, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

.up-desc {
  font-size: 11px;
  color: var(--text-dim);
}

.game-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #3a2e24 0%, #231a14 100%);
  border: 1px solid var(--border-gold-bright);
  color: var(--text-gold);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  min-height: var(--touch-min);
  min-width: 80px;
}

.game-btn:hover {
  background: linear-gradient(180deg, #4f3f31 0%, #2e231b 100%);
  box-shadow: 0 0 10px var(--gold-glow);
}

.game-btn:active {
  transform: scale(0.97);
}

.game-btn:disabled, .game-btn.cannot-afford {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.up-btn .btn-cost {
  font-size: 10px;
  color: var(--text-dim);
}

/* 质变特技卡 */
.traits-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trait-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trait-card.trait-active {
  border-color: var(--border-gold-bright);
  background: linear-gradient(135deg, rgba(246, 200, 95, 0.1) 0%, rgba(31, 25, 22, 1) 100%);
}

.trait-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trait-name {
  font-weight: 700;
  color: var(--text-gold);
  font-size: 12px;
}

.trait-status {
  font-size: 10px;
  color: var(--text-dim);
}

.trait-desc {
  font-size: 11px;
  color: var(--text-dim);
}

.trait-unlocked-tag {
  font-size: 11px;
  color: #4ade80;
  font-weight: 700;
  text-align: right;
}

/* 自动化契约列表 */
.automation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auto-row {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auto-name {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-main);
  display: block;
}

.auto-status-tag {
  font-size: 10px;
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
}

.auto-status-tag.tag-on {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.auto-status-tag.tag-off {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.auto-row-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.auto-row-card .auto-row {
  border: none;
  border-radius: 0;
}

.auto-config-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px dashed rgba(212, 163, 89, 0.2);
  font-size: 11px;
  color: var(--text-dim);
}

.auto-sub-label {
  font-size: 10px;
  color: var(--accent-gold);
  font-weight: 600;
}

.auto-quality-select {
  background: #1e1713;
  color: #f5eedc;
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  outline: none;
  cursor: pointer;
}

.auto-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
}

.auto-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* ==========================================================================
   4. 中栏：全景视差战斗视口
   ========================================================================== */
.col-center {
  flex: 1;
  padding: 12px;
  background: #0d0a08;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.battle-viewport {
  position: relative;
  width: 100%;
  height: 380px;
  min-height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-gold-bright);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  background: #000;
  cursor: crosshair;
}

/* 视差分层 */
.battle-bg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-bg-layer.bg-special-transition {
  transition: opacity 1.5s ease-in-out;
}

/* 战场角色与怪物实体 */
.battle-actor {
  position: absolute;
  bottom: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.hero-actor {
  left: 15%;
  z-index: 5;
}

.hero-halo {
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(246, 200, 95, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  top: 10px;
  z-index: -1;
}

.actor-sprite {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

.hero-sprite-anim {
  animation: heroIdleBob 2.5s ease-in-out infinite;
}

@keyframes heroIdleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.actor-hp-bar {
  width: 80px;
  height: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
  transition: width 0.15s ease-out;
}

.hero-hp-bar .hp-fill {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.enemy-hp-bar .hp-fill {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
}

.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.enemy-actor {
  right: 15%;
  z-index: 5;
  cursor: pointer;
}

.enemy-name-plate {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(12, 10, 9, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #444;
  margin-bottom: 4px;
}

.enemy-badge-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
}

.enemy-badge-tag.tag-normal { background: #64748b; }
.enemy-badge-tag.tag-elite { background: #8b5cf6; }
.enemy-badge-tag.tag-boss { background: #ef4444; }

.enemy-name-text {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.enemy-idle-anim {
  animation: enemyBreathe 2.0s ease-in-out infinite alternate;
}

@keyframes enemyBreathe {
  from { transform: scale(1); }
  to { transform: scale(1.05) translateY(-3px); }
}

/* 动效与光效 */
.vfx-slash-container {
  position: absolute;
  right: 14%;
  bottom: 60px;
  width: 110px;
  height: 110px;
  pointer-events: none;
  opacity: 0;
  z-index: 8;
}

.vfx-slash-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vfx-slash-container.vfx-active {
  animation: slashBurst 0.25s ease-out forwards;
}

@keyframes slashBurst {
  0% { opacity: 0; transform: scale(0.6) rotate(-20deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(10deg); }
  100% { opacity: 0; transform: scale(1.2) rotate(25deg); }
}

.vfx-hit-container {
  position: absolute;
  right: 16%;
  bottom: 80px;
  width: 80px;
  height: 80px;
  pointer-events: none;
  opacity: 0;
  z-index: 9;
}

.vfx-hit-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vfx-hit-container.vfx-active {
  animation: hitSpark 0.22s ease-out forwards;
}

@keyframes hitSpark {
  0% { opacity: 1; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* 飘字系统 */
.floating-text-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.floating-num {
  position: absolute;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 10px #000;
  animation: floatUp 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  20% { opacity: 1; transform: translateY(-15px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-50px) scale(0.9); }
}

.floating-num.normal { color: #fff; }
.floating-num.crit { color: #f59e0b; font-size: 22px; }
.floating-num.supernova { color: #ec4899; font-size: 28px; text-shadow: 0 0 15px #f43f5e; }
.floating-num.tap-dmg { color: #38bdf8; font-size: 15px; }
.floating-num.enemy-dmg { color: #ef4444; font-size: 14px; left: 20% !important; }
.floating-num.gold-gain { color: #facc15; font-size: 15px; }
.floating-num.points-gain { color: #38bdf8; font-size: 16px; font-weight: 900; }

/* 掉落物飞散与战场战利品 */
.loot-drop-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.anim-loot-fly {
  position: absolute;
  right: 18%;
  bottom: 80px;
  width: 36px;
  height: 36px;
  animation: lootArcFly 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes lootArcFly {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  50% { transform: translate(-80px, -60px) scale(1.2); }
  100% { opacity: 0; transform: translate(-200px, 40px) scale(0.4); }
}

/* 战场手动可点击战利品光球 */
.battlefield-loot-orb {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
  transition: transform 0.15s ease, opacity 0.3s ease;
  animation: lootOrbFloat 1.8s ease-in-out infinite alternate;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.battlefield-loot-orb:hover {
  transform: scale(1.15);
}

.battlefield-loot-orb:active {
  transform: scale(0.92);
}

.loot-orb-icon-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 25, 20, 0.9) 0%, rgba(12, 10, 9, 0.95) 100%);
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5), inset 0 0 8px rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.battlefield-loot-orb.quality-common .loot-orb-icon-wrap {
  border-color: #94a3b8;
  box-shadow: 0 0 8px rgba(148, 163, 184, 0.4);
}
.battlefield-loot-orb.quality-uncommon .loot-orb-icon-wrap {
  border-color: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}
.battlefield-loot-orb.quality-rare .loot-orb-icon-wrap {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}
.battlefield-loot-orb.quality-epic .loot-orb-icon-wrap {
  border-color: #a855f7;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.7);
}
.battlefield-loot-orb.quality-legendary .loot-orb-icon-wrap {
  border-color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.8);
}
.battlefield-loot-orb.quality-cosmic .loot-orb-icon-wrap {
  border-color: #ec4899;
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.9);
}

.loot-orb-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.loot-orb-label {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}

.loot-orb-prompt {
  font-size: 9px;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  pointer-events: none;
  animation: promptPulse 1s ease-in-out infinite alternate;
}

@keyframes lootOrbFloat {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-8px); }
}

@keyframes promptPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; transform: scale(1.05); }
}

/* 灵怪助手状态标识 */
.loot-companion-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  color: #38bdf8;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: companionPulse 2s ease-in-out infinite;
}

.companion-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

@keyframes companionPulse {
  0%, 100% { border-color: rgba(56, 189, 248, 0.3); }
  50% { border-color: rgba(56, 189, 248, 0.8); }
}

.battle-overlay-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 10, 9, 0.75);
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* 战报日志卡 */
.battle-log-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.log-title-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.log-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-gold);
}

.log-scroll-view {
  flex: 1;
  overflow-y: auto;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-item.system { color: #f59e0b; }
.log-item.info { color: var(--text-main); }

/* 移动端常驻大拇指操作栏 */
.mobile-thumb-bar {
  display: none;
  gap: 10px;
  width: 100%;
}

.thumb-btn {
  flex: 1;
  height: 48px;
  font-size: 14px;
}

.thumb-strike {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  color: #fef3c7;
  border-color: #f59e0b;
}

.thumb-sell {
  background: linear-gradient(180deg, #15803d 0%, #14532d 100%);
  color: #dcfce7;
  border-color: #22c55e;
}

/* ==========================================================================
   5. 右栏：城镇商会、战利品背包与世界地图
   ========================================================================== */
.col-right {
  width: 360px;
  min-width: 340px;
  border-left: 1px solid rgba(92, 71, 51, 0.4);
}

.shop-merchant-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: linear-gradient(135deg, rgba(92, 71, 51, 0.2) 0%, rgba(31, 25, 22, 1) 100%);
}

.merchant-avatar-wrap {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-gold-bright);
  background: #2b1f17;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merchant-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.merchant-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-gold);
}

.merchant-words {
  font-size: 11px;
  color: var(--text-main);
  line-height: 1.3;
}

/* 战利品背包 */
.inventory-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.inv-capacity {
  font-size: 11px;
  color: var(--text-dim);
}

.inv-estimate-line {
  font-size: 11px;
  color: var(--text-gold);
  font-weight: 700;
}

.loot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.loot-slot {
  aspect-ratio: 1;
  background: rgba(12, 10, 9, 0.7);
  border: 1px dashed var(--border-gold-dim);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}

.loot-slot.slot-filled {
  border-style: solid;
  background: #201915;
}

.loot-slot.slot-filled:hover {
  transform: scale(1.05);
  box-shadow: 0 0 8px rgba(246, 200, 95, 0.4);
}

.loot-slot.quality-common { border-color: #94a3b8; }
.loot-slot.quality-uncommon { border-color: #22c55e; }
.loot-slot.quality-rare { border-color: #38bdf8; }
.loot-slot.quality-epic { border-color: #c084fc; }
.loot-slot.quality-legendary { border-color: #f59e0b; }
.loot-slot.quality-cosmic { border-color: #f472b6; }

.slot-img {
  width: 75%;
  height: 75%;
  object-fit: contain;
}

.slot-quality-tag {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 8px;
  padding: 0 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

.quick-sell-btn {
  width: 100%;
  height: 44px;
  background: linear-gradient(180deg, #15803d 0%, #166534 100%);
  border-color: #22c55e;
  color: #fff;
}

.quick-sell-btn .btn-subtext {
  font-size: 10px;
  color: #bbf7d0;
}

/* 世界地图演进列表 */
.map-portal-card {
  background: var(--bg-parchment-card);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.realm-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.realm-card {
  background: rgba(12, 10, 9, 0.8);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.realm-card.realm-current {
  border-color: var(--border-gold-bright);
  background: rgba(246, 200, 95, 0.08);
}

.realm-card.realm-locked {
  opacity: 0.65;
}

.realm-visual-wrap {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.realm-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.realm-status-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-gold);
}

.realm-info-col {
  flex: 1;
}

.realm-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.realm-desc {
  font-size: 10px;
  color: var(--text-dim);
}

.realm-btn {
  min-height: 36px;
  min-width: 72px;
  font-size: 11px;
}

.realm-btn.btn-portal {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #38bdf8;
  color: #fff;
}

.realm-btn.btn-unlock {
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #a78bfa;
  color: #fff;
}

/* ==========================================================================
   6. 移动端独立面板与底部 Tab 栏
   ========================================================================== */
.col-maps {
  display: none;
}

.mobile-only-tabbar {
  display: none;
  height: 52px;
  min-height: 52px;
  background: #140f0c;
  border-top: 1px solid var(--border-gold-dim);
  align-items: center;
  justify-content: space-around;
  z-index: 30;
}

.m-tab-btn {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-height: 48px;
}

.m-tab-btn.active {
  color: var(--text-gold);
  background: rgba(246, 200, 95, 0.12);
  border-top: 2px solid var(--border-gold-bright);
}

/* ==========================================================================
   7. Teach-by-Doing 聚光灯遮罩
   ========================================================================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.spotlight-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.guide-tooltip {
  position: absolute;
  pointer-events: auto;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  background: #1a1410;
  border: 2px solid var(--border-gold-bright);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 101;
}

.guide-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-gold);
}

.guide-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.guide-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-serif);
}

.guide-text {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.4;
}

.guide-pointer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-gold);
  font-weight: 700;
}

.finger-pulse {
  width: 14px;
  height: 14px;
  background: var(--text-gold);
  border-radius: 50%;
  animation: ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% { transform: scale(1.8); opacity: 0; }
}

.skip-btn {
  background: transparent;
  border: 1px solid var(--border-gold-dim);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  align-self: flex-end;
}

/* 全屏 Toast 提示 */
.toast-message {
  position: fixed;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 14, 12, 0.95);
  border: 1px solid var(--border-gold-bright);
  color: var(--text-gold);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
  z-index: 99;
  pointer-events: none;
}

/* ==========================================================================
   8. 多端响应式适配媒体查询 (Mobile vs Desktop)
   ========================================================================== */

/* 移动端视口 (宽度 <= 900px) */
@media (max-width: 900px) {
  #main-tactical-board {
    flex-direction: column;
  }

  .tactical-col {
    display: none !important;
    width: 100% !important;
    border: none !important;
    flex: 1;
  }

  /* 仅激活当前选中的 Tab */
  .tactical-col.mobile-active-tab {
    display: flex !important;
  }

  .mobile-only-tabbar {
    display: flex;
  }

  .mobile-thumb-bar {
    display: flex;
  }

  .battle-viewport {
    height: 320px;
    min-height: 280px;
  }

  #pc-map-card {
    display: none;
  }

  .col-maps {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .col-maps .mobile-map-list-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 10px 12px 85px 12px;
    overflow-y: auto;
  }

  .col-maps .realm-list-container {
    max-height: none !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .col-maps .realm-card {
    padding: 12px;
    background: rgba(22, 17, 36, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
  }

  .col-maps .realm-title {
    font-size: 14px;
    font-weight: 700;
  }

  .col-maps .realm-desc {
    font-size: 12px;
    margin-top: 4px;
  }

  .col-maps .realm-btn {
    min-height: 44px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
  }
}

/* 战术横条：战场世界地图快速跳转指引 */
.battle-realm-jump-bar {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, rgba(22, 17, 36, 0.95) 0%, rgba(13, 10, 24, 0.95) 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.battle-realm-jump-bar:hover {
  border-color: #ffd700;
  background: linear-gradient(90deg, rgba(32, 25, 54, 0.98) 0%, rgba(20, 15, 36, 0.98) 100%);
}

.jump-bar-left {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  flex-shrink: 0;
}

.jump-bar-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.jump-bar-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jump-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffd700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jump-bar-sub {
  font-size: 11px;
  color: #bfa77a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jump-bar-right {
  flex-shrink: 0;
}

.jump-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  min-height: 36px;
}

.jump-btn-ready {
  background: linear-gradient(135deg, #ffd700 0%, #ff8800 100%) !important;
  color: #1a0f00 !important;
  border-color: #ffd700 !important;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.8) !important;
  animation: pulseJumpBtn 1.5s ease-in-out infinite;
}

@keyframes pulseJumpBtn {
  0%, 100% { transform: scale(1.0); box-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
  50% { transform: scale(1.05); box-shadow: 0 0 16px rgba(255, 215, 0, 1.0); }
}

/* 桌面端大屏视口 (宽度 > 900px) */
@media (min-width: 901px) {
  .col-left {
    display: flex !important;
  }

  .col-center {
    display: flex !important;
  }

  .col-right {
    display: flex !important;
  }

  .col-maps {
    display: none !important;
  }

  .mobile-only-tabbar {
    display: none !important;
  }

  .mobile-thumb-bar {
    display: none !important;
  }
}

/* ==================== 终局胜利通关典礼弹窗 ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 2, 8, 0.88);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.4s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.0); }
}

.victory-card {
  max-width: 520px;
  width: 100%;
  background: linear-gradient(145deg, #161128 0%, #0d0a18 100%);
  border: 2px solid #ffd700;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.35), 0 20px 50px rgba(0, 0, 0, 0.9);
  padding: 24px;
  text-align: center;
  color: #f0e6d2;
  position: relative;
  overflow: hidden;
}

.victory-header {
  margin-bottom: 20px;
}

.victory-emblem {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}

.emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 16px #ffd700);
  animation: pulseEmblem 2.4s ease-in-out infinite;
}

@keyframes pulseEmblem {
  0%, 100% { transform: scale(1.0); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 24px #ffaa00); }
}

.victory-title {
  font-size: 22px;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
  margin: 0 0 6px 0;
  letter-spacing: 1px;
}

.victory-subtitle {
  font-size: 13px;
  color: #bfa77a;
  margin: 0;
  line-height: 1.5;
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.v-stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v-stat-label {
  font-size: 11px;
  color: #9f8c6b;
  margin-bottom: 4px;
}

.v-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.v-stat-val.highlight {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.victory-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.v-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.v-btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #ff8800 100%);
  color: #1a0f00;
  border: 1px solid #ffd700;
  box-shadow: 0 4px 15px rgba(255, 170, 0, 0.4);
}

.v-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 170, 0, 0.6);
}

.v-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #d4af37;
  border: 1px solid rgba(212, 175, 55, 0.5);
}

.v-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

