/* 组件样式 - 面板/按钮/卡片/HP条/弹窗（wuxia-ui-design 规范） */

/* 面板 */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}

.panel-title {
  font-size: 15px;
  color: var(--text-gold);
  letter-spacing: 3px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before, .panel-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
  color: var(--text-primary);
  background: var(--ink-medium);
}

.btn:active { transform: scale(0.96); filter: brightness(0.85); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: var(--ink-black);
  border-color: var(--gold-light);
  box-shadow: 0 4px 12px rgba(212, 167, 69, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #8e2418, var(--vermillion));
  border-color: #e07b6e;
}

.btn-block { display: flex; width: 100%; }

/* 章节标题 */
.chapter-title {
  text-align: center;
  font-size: 22px;
  color: var(--gold-primary);
  text-shadow: 0 0 20px rgba(212, 167, 69, 0.5);
  letter-spacing: 8px;
  margin: 12px 0;
}

/* 角色卡片 */
.hero-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.hero-avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--ink-medium);
  border: 1px solid var(--panel-border);
}

.hero-meta { flex: 1; min-width: 0; }

.hero-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.hero-stars { font-size: 11px; color: var(--gold-primary); }

.hero-tags {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.hero-power {
  font-size: 12px;
  color: var(--text-gold);
  margin-top: 2px;
}

/* 稀有度边框 */
[data-rarity="white"]  { border-color: var(--rarity-white); }
[data-rarity="green"]  { border-color: var(--rarity-green); }
[data-rarity="blue"]   { border-color: var(--rarity-blue); }
[data-rarity="purple"] { border-color: var(--rarity-purple); }
[data-rarity="orange"] {
  border-color: var(--rarity-orange);
  box-shadow: 0 0 12px rgba(230, 126, 34, 0.35);
}
[data-rarity="red"] {
  border-color: var(--rarity-red);
  box-shadow: 0 0 16px rgba(231, 76, 60, 0.45);
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(231, 76, 60, 0.35); }
  50% { box-shadow: 0 0 22px rgba(231, 76, 60, 0.65); }
}

.rarity-text-white  { color: var(--rarity-white); }
.rarity-text-green  { color: var(--rarity-green); }
.rarity-text-blue   { color: var(--rarity-blue); }
.rarity-text-purple { color: var(--rarity-purple); }
.rarity-text-orange { color: var(--rarity-orange); }
.rarity-text-red    { color: var(--rarity-red); }

/* HP条 */
.hp-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.hp-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.25s ease;
  border-radius: 3px;
}

.hp-bar .fill.low { background: linear-gradient(90deg, #c0392b, #e74c3c); }

/* 战斗单位 */
.battle-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
}

.battle-unit {
  width: 88px;
  text-align: center;
  position: relative;
  transition: transform 0.15s;
}

.battle-unit .unit-avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
}

.battle-unit.enemy .unit-avatar { border-color: rgba(192, 57, 43, 0.6); }

.battle-unit .unit-name { font-size: 11px; margin-top: 3px; }
.battle-unit.dead { opacity: 0.3; filter: grayscale(1); }
.battle-unit.attacking { transform: translateY(-8px) scale(1.08); }
.battle-unit.enemy.attacking { transform: translateY(8px) scale(1.08); }

/* 伤害飘字 */
.damage-popup {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 18px;
  font-weight: bold;
  color: #ff6b6b;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  animation: damageFloat 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.damage-popup.crit { font-size: 24px; color: #ffaa00; }
.damage-popup.dodge { font-size: 14px; color: var(--text-secondary); }

@keyframes damageFloat {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 1; }
  30% { transform: translate(-50%, -18px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -44px) scale(1); opacity: 0; }
}

/* 战斗日志 */
.battle-log {
  height: 72px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}

.battle-log .log-line { padding: 1px 0; }
.battle-log .log-line.skill { color: var(--text-gold); }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

.modal-content {
  width: 86%;
  max-width: 360px;
  max-height: 82vh; /* 小屏防溢出：武功列表等长内容不再撑出屏幕 */
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--gold-primary);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 20px;
  color: var(--gold-primary);
  letter-spacing: 6px;
  margin-bottom: 12px;
}

.modal-body {
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 16px;
  flex: 1 1 auto;
  min-height: 0; /* flex子项允许收缩，配合overflow滚动 */
  overflow-y: auto; /* 长列表（武功选择/侠客列表）内部滚动 */
  -webkit-overflow-scrolling: touch;
}
.modal-body .reward-line { color: var(--text-gold); }
.modal-body .loss { color: #e07b6e; }

/* 提示Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.82);
  color: var(--text-primary);
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  animation: toastFade 1.6s ease forwards;
  pointer-events: none;
}

@keyframes toastFade {
  0% { opacity: 0; }
  15%, 75% { opacity: 1; }
  100% { opacity: 0; }
}

/* 数值高亮 */
.stat-gold { color: var(--text-gold); }
.text-muted { color: var(--text-secondary); font-size: 12px; }

/* ===== M2：阵容编辑 ===== */
.formation-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.formation-slot {
  width: 64px;
  min-height: 76px;
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  background: var(--ink-medium);
  text-align: center;
  padding: 6px 2px;
  cursor: pointer;
  transition: transform 0.1s;
}

.formation-slot:active { transform: scale(0.95); }
.formation-slot.empty { border-style: dashed; opacity: 0.55; cursor: default; }
.formation-slot .slot-avatar { font-size: 22px; }
.formation-slot .slot-name { font-size: 11px; margin-top: 2px; }
.formation-slot .slot-level { font-size: 10px; color: var(--text-secondary); }

.badge-formation {
  font-size: 10px;
  color: var(--ink-black);
  background: var(--gold-primary);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ===== M2：抽卡界面 ===== */
.up-hero-banner {
  display: inline-block;
  padding: 12px 32px;
  border: 2px solid var(--rarity-red);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(231, 76, 60, 0.12), transparent);
  animation: pulseGlow 2s infinite;
}

.pity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.pity-row > span:first-child { width: 48px; flex-shrink: 0; }

.pity-bar {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.pity-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.recruit-result {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.recruit-result.hidden { display: none; }

.recruit-card {
  width: 92px;
  padding: 10px 4px;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  background: var(--ink-dark);
  text-align: center;
  position: relative;
  animation: cardFlip 0.5s ease-out backwards;
}

.recruit-result:not(.ten) .recruit-card { width: 130px; padding: 18px 8px; }
.recruit-result:not(.ten) .card-emoji { font-size: 40px; }

@keyframes cardFlip {
  0% { transform: rotateY(90deg) scale(0.6); opacity: 0; }
  60% { transform: rotateY(-10deg) scale(1.06); opacity: 1; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

.recruit-card .card-emoji { font-size: 28px; }
.recruit-card .card-name { font-size: 13px; margin-top: 4px; }
.recruit-card .card-sub { font-size: 10px; color: var(--gold-primary); }
.recruit-card .card-note { font-size: 10px; color: var(--text-secondary); margin-top: 3px; }

.badge-new {
  color: var(--ink-black);
  background: var(--jade-green);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: bold;
}

.badge-ceil {
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 10px;
  color: #fff;
  background: var(--vermillion);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ============ M3：章节地图 ============ */
.chapter-card { padding: 10px 12px; }
.chapter-card.locked { opacity: 0.55; }

.chapter-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.chapter-name { font-size: 15px; color: var(--text-primary); font-weight: bold; }
.chapter-card.locked .chapter-name { color: var(--text-secondary); }

.chapter-progress {
  font-size: 13px;
  color: var(--gold-primary);
  white-space: nowrap;
}
.chapter-progress.done { color: var(--jade-green); }

.chapter-arrow { color: var(--text-secondary); font-size: 12px; }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.stage-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid var(--panel-border);
  background: var(--ink-medium);
  color: var(--text-primary);
  transition: transform 0.1s;
}
.stage-cell:active { transform: scale(0.92); }

.stage-cell.cleared {
  color: var(--jade-green);
  border-color: rgba(39, 174, 96, 0.5);
  background: rgba(39, 174, 96, 0.1);
}
.stage-cell.current {
  color: var(--ink-black);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 167, 69, 0.5);
}
.stage-cell.locked {
  opacity: 0.4;
  cursor: not-allowed;
  font-size: 11px;
}

/* ============ M3：缘分/武功 ============ */
.affinity-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--gold-light);
  background: rgba(212, 167, 69, 0.12);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 2px 6px;
  margin: 2px;
}

#affinity-list { text-align: center; margin-top: 6px; }

.skill-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--panel-border);
}
.skill-slot:last-child { border-bottom: none; }

.skill-pick { font-size: 13px; }

/* ============ M3：藏经阁 ============ */
.tower-floor-num {
  font-size: 26px;
  font-weight: bold;
  color: var(--gold-primary);
  text-shadow: 0 0 16px rgba(212, 167, 69, 0.5);
  margin-bottom: 4px;
}

.tower-enemy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--panel-border);
  font-size: 13px;
}
.tower-enemy:last-child { border-bottom: none; }
.tower-enemy.boss { color: var(--vermillion); font-weight: bold; }

/* ============ M4：华山论剑 ============ */
.pvp-my-rank {
  font-size: 26px;
  font-weight: bold;
  color: var(--gold-primary);
  text-shadow: 0 0 16px rgba(212, 167, 69, 0.5);
  margin-bottom: 4px;
}

.pvp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--panel-border);
  font-size: 13px;
}
.pvp-row:last-child { border-bottom: none; }

.pvp-row.player {
  background: rgba(212, 167, 69, 0.08);
  border-radius: 6px;
  padding: 8px 6px;
  border-bottom: none;
}

.pvp-rank {
  width: 34px;
  text-align: center;
  font-weight: bold;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.pvp-rank.top { color: var(--gold-primary); }

.pvp-name { flex: 1; min-width: 0; }
.pvp-power { text-align: right; white-space: nowrap; font-size: 12px; }

/* ============ M5：存档管理 ============ */
.save-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px dashed var(--panel-border);
  font-size: 13px;
}
.save-slot:last-child { border-bottom: none; }
.save-slot.active {
  background: rgba(212, 167, 69, 0.08);
  border-radius: 6px;
  border-bottom: none;
}
.save-slot-info { flex: 1; min-width: 0; }
.save-slot-btns { display: flex; gap: 6px; flex-shrink: 0; }
.save-slot-badge {
  display: inline-block;
  font-size: 10px;
  color: var(--gold-primary);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: 1px;
}

.save-textarea {
  width: 100%;
  min-height: 90px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 8px;
  resize: vertical;
  font-family: inherit;
}
.save-textarea:focus { outline: none; border-color: var(--gold-primary); }

/* ========== 新手引导（M5/T504） ========== */
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboard-card {
  width: 86%;
  max-width: 360px;
  background: var(--panel-bg);
  border: 1px solid var(--gold-primary);
  border-radius: 12px;
  padding: 22px 18px 16px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.onboard-icon { font-size: 40px; margin-bottom: 8px; }
.onboard-title {
  font-size: 18px;
  color: var(--gold-primary);
  margin-bottom: 10px;
}
.onboard-text {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-primary);
  text-align: left;
  min-height: 84px;
}
.onboard-text b { color: var(--gold-primary); }
.onboard-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 12px;
}
.onboard-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
}
.onboard-dot.active {
  background: var(--gold-primary);
  opacity: 1;
}
.onboard-skip {
  margin-top: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px;
}

/* ========== 帮派系统（M6/T601） ========== */
.gang-card { padding: 12px; }
.gang-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gang-emoji { font-size: 28px; }

.buff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--panel-border);
  font-size: 13px;
}
.buff-row:last-child { border-bottom: none; }

/* ========== 批量战斗次数选择（M6/T605） ========== */
.chip {
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 3px 9px;
  cursor: pointer;
}
.chip.active {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  background: rgba(212, 167, 69, 0.12);
}

/* ========== 装备背包（M6/T602） ========== */
.equip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--panel-border);
}
.equip-row:last-child { border-bottom: none; }
.equip-info { flex: 1; min-width: 0; }
.equip-info .rarity-text-white,
.equip-info .rarity-text-green,
.equip-info .rarity-text-blue,
.equip-info .rarity-text-purple,
.equip-info .rarity-text-orange {
  font-weight: bold;
}

/* ========== FPS性能面板（M6/T603） ========== */
#fps-panel {
  position: fixed;
  top: 6px;
  left: 6px;
  z-index: 300;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: monospace;
  padding: 4px 8px;
  pointer-events: none;
}
#fps-panel.fps-good { color: #7fd97f; border-color: #7fd97f; }
#fps-panel.fps-ok   { color: var(--gold-primary); border-color: var(--gold-primary); }
#fps-panel.fps-bad  { color: #e07b6e; border-color: #e07b6e; }

/* ========== 每日签到（M7/T611） ========== */
.sign-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sign-cell {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  opacity: 0.55;
}
.sign-cell.done { opacity: 1; border-color: var(--gold-primary); }
.sign-cell.today { border-color: var(--gold-primary); background: rgba(212,167,69,0.12); box-shadow: 0 0 6px rgba(212,167,69,0.35); }
.sign-day { font-size: 11px; color: var(--text-secondary); }
.sign-reward { font-size: 16px; margin: 2px 0; }
.sign-label { font-size: 10px; color: var(--text-muted); }

/* ========== 红点角标（M7/T611+T614） ========== */
.red-dot {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 8px;
  height: 8px;
  padding: 0 3px;
  border-radius: 8px;
  background: #e07b6e;
  color: #fff;
  font-size: 9px;
  line-height: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ========== 侠客突破/装备强化标记（M7/T613+T612） ========== */
.hero-rank {
  color: var(--gold-primary);
  font-size: 11px;
  border: 1px solid var(--gold-primary);
  border-radius: 4px;
  padding: 0 3px;
  margin-left: 2px;
}


