/* 凡人修仙传 · AI 聊天主界面骨架（三栏） */
:root {
  --mj-main-bg: #0f1412;
  --mj-panel-bg: rgba(22, 28, 24, 0.92);
  --mj-border: rgba(140, 120, 83, 0.45);
  --mj-gold: #e8c547;
  --mj-gold-dim: #b89a4a;
  --mj-text: #e8e4dc;
  --mj-muted: #8a9088;
  --mj-chat-bg: rgba(0, 0, 0, 0.28);
}

/* 滚动条美化：统一细窄风格（Chrome/Edge/Firefox） */
* {
  scrollbar-width: thin; /* Firefox：细条 */
  scrollbar-color: rgba(140, 120, 83, 0.7) rgba(0, 0, 0, 0.18); /* thumb track */
}

*::-webkit-scrollbar {
  width: 4px; /* 细条 */
  height: 4px;
}

*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(140, 120, 83, 0.62);
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.22); /* thumb 描边 */
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(232, 197, 71, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body.mj-main-body {
  font-family: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--mj-main-bg);
  color: var(--mj-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mj-main-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--mj-border);
  background: linear-gradient(180deg, rgba(30, 36, 32, 0.98), rgba(18, 22, 20, 0.95));
}

.mj-main-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mj-gold);
  letter-spacing: 0.06em;
}

/* 顶部副标题 .mj-sub 已移除 */

.mj-main-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 300px) 1fr minmax(220px, 280px);
  gap: 0;
}

.mj-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--mj-border);
  background: var(--mj-panel-bg);
}

.mj-pane:last-child {
  border-right: none;
}

.mj-npc-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--mj-border);
  background: linear-gradient(180deg, rgba(18, 22, 20, 0.92), rgba(12, 15, 13, 0.96));
}

.mj-secondary-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(216, 185, 117, 0.28);
  background: rgba(24, 28, 25, 0.55);
  color: var(--mj-text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.mj-secondary-btn:hover {
  border-color: rgba(216, 185, 117, 0.5);
  background: rgba(24, 28, 25, 0.7);
}

.mj-secondary-btn:active {
  transform: translateY(1px);
}

.mj-secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mj-pane-header {
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mj-gold-dim);
  border-bottom: 1px solid var(--mj-border);
  background: rgba(0, 0, 0, 0.2);
}

/* 移动端专用控件：默认（网页端）隐藏，避免影响原布局 */
.mj-mobile-open-btn,
.mj-mobile-panel-close {
  display: none;
}

/* 主界面聊天标题栏：默认按旧版标题显示 */
.mj-chat-pane-header {
  display: block;
}

.mj-chat-pane-title {
  display: block;
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
}

.mj-pane-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
}

/* 左栏 · 角色信息 */
.mj-pane--player {
  position: relative;
}

/* 右栏 · 周围人物（与左栏同构顶条） */
.mj-pane--npc {
  position: relative;
}

/**
 * 世界时间 / 当前地点：在分栏标题之上，不参与下方滚动，始终可见。
 * 左用 .mj-player-world-fixed，右用 .mj-npc-location-fixed，样式一致。
 */
.mj-player-world-fixed,
.mj-npc-location-fixed {
  flex-shrink: 0;
  z-index: 3;
  padding: 10px 14px 10px;
  border-bottom: 1px solid var(--mj-border);
  background: linear-gradient(180deg, rgba(28, 34, 30, 0.99), rgba(20, 26, 22, 0.96));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.mj-player-body {
  padding-top: 10px;
  /** 左栏正文统一字号（标签与数值同尺寸；不含 .mj-attr-section-title 等章节标题） */
  --mj-player-content-font: 0.9rem;
}

/** 功法 / 储物袋：标题固定，仅下方 3×4 网格区域各自独立滚动（格数增多时） */
.mj-player-bag-stack {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(140, 120, 83, 0.22);
}

.mj-bag-grid-scroll {
  max-height: min(26vh, 15rem);
  overflow-x: hidden;
  overflow-y: auto;
  margin-bottom: 4px;
  scrollbar-gutter: stable;
}

.mj-bag-grid-scroll--gongfa {
  max-height: none;
  overflow: visible;
}

.mj-bag-grid-scroll .mj-inventory-grid {
  margin-top: 6px;
}

.mj-world-time {
  text-align: center;
  font-size: 0.82rem;
  color: var(--mj-gold-dim);
  letter-spacing: 0.04em;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(140, 120, 83, 0.25);
}

.mj-player-avatar-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  flex-direction: column;
  gap: 6px;
}

.mj-player-name-vertical {
  position: static;
  transform: none;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  letter-spacing: 0.08em;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(232, 197, 71, 0.92);
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.mj-player-avatar-wrap .mj-player-avatar.hidden {
  display: none;
}

.mj-player-avatar-wrap .mj-player-avatar:not(.hidden) ~ .mj-player-avatar--placeholder {
  display: none;
}

.mj-player-avatar {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--mj-border);
}

.mj-player-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: var(--mj-muted);
  font-size: 0.78rem;
  user-select: none;
}

.mj-realm-line {
  font-size: var(--mj-player-content-font);
  color: var(--mj-text);
  margin: 0 0 10px;
  text-align: center;
}

.mj-player-identity {
  margin: 12px 0 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(140, 120, 83, 0.25);
}

.mj-combat-stats {
  margin-top: 4px;
  margin-bottom: 4px;
}

.mj-resource-row {
  margin-bottom: 10px;
}

.mj-resource-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--mj-player-content-font);
  color: var(--mj-muted);
  margin-bottom: 4px;
}

.mj-cultivation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.mj-resource-label--cultivation {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.mj-major-breakthrough-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background: rgba(0, 0, 0, 0.4);
  color: var(--mj-gold);
  cursor: pointer;
}

.mj-major-breakthrough-btn:hover {
  border-color: rgba(255, 215, 120, 0.85);
  background: rgba(212, 175, 55, 0.12);
}

.mj-major-break-modal .mj-major-break-subtitle {
  font-size: 0.88rem;
  color: var(--mj-muted);
  margin-bottom: 10px;
  text-align: center;
}

.mj-major-break-chance {
  font-size: 1rem;
  color: var(--mj-gold);
  text-align: center;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.mj-major-break-slots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mj-major-break-slot {
  width: 72px;
  min-height: 64px;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid rgba(140, 120, 83, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: var(--mj-text, #e8e4dc);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.mj-major-break-slot:hover {
  border-color: rgba(212, 175, 55, 0.55);
}

.mj-major-break-slot--filled {
  border-color: rgba(129, 199, 132, 0.45);
}

.mj-major-break-slot-k {
  font-size: 0.65rem;
  color: var(--mj-muted);
}

.mj-major-break-slot-name {
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}

.mj-major-break-pick {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
}

.mj-major-break-pick-hint {
  font-size: 0.78rem;
  color: var(--mj-muted);
  margin-bottom: 8px;
}

.mj-major-break-pick-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 0.8rem;
  text-align: left;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  color: var(--mj-text, #e8e4dc);
  cursor: pointer;
}

.mj-major-break-pick-btn:hover {
  border-color: rgba(212, 175, 55, 0.45);
}

.mj-major-break-pick-empty {
  font-size: 0.8rem;
  color: var(--mj-muted);
}

.mj-major-break-confirm {
  width: 100%;
  margin-top: 8px;
}

.mj-resource-nums {
  font-size: 1em;
  color: var(--mj-gold);
  font-variant-numeric: tabular-nums;
}

.mj-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mj-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s ease;
}

.mj-bar-fill--cultivation {
  background: linear-gradient(90deg, #5d4e37, var(--mj-gold));
}

.mj-bar-fill--hp {
  background: linear-gradient(90deg, #8b2942, #c62828);
}

.mj-bar-fill--mp {
  background: linear-gradient(90deg, #1565c0, #4fc3f7);
}

.mj-attr-section-title {
  margin: 16px 0 10px;
  padding-bottom: 6px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--mj-gold);
  border-bottom: 1px solid var(--mj-border);
}

.mj-attr-section-title--first {
  margin-top: 4px;
}

.mj-stat-pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  padding: 7px 0;
  font-size: var(--mj-player-content-font);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  align-items: start;
}

.mj-stat-cell {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.mj-stat-k {
  font-size: 1em;
  color: var(--mj-muted);
  flex-shrink: 0;
}

.mj-stat-v {
  font-size: 1em;
  color: var(--mj-text);
  text-align: right;
  word-break: break-word;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

/* 天赋：年龄/寿元下方一行五槽（逆天改命）；年龄行沿用 .mj-stat-pair-row 底部分隔线 */
.mj-talent-block {
  margin-top: 2px;
  padding-top: 0;
}

.mj-talent-heading {
  font-size: var(--mj-player-content-font);
  color: var(--mj-muted);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.mj-talent-row {
  display: flex;
  flex-direction: row;
  gap: 5px;
  width: 100%;
  align-items: flex-start;
}

.mj-trait-slot {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 3px;
  border-radius: 6px;
  border: 1px solid rgba(140, 120, 83, 0.45);
  background: rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
  overflow: hidden;
}

.mj-trait-slot--empty {
  border-style: dashed;
  opacity: 0.75;
}

.mj-trait-slot--empty .mj-trait-slot-inner {
  color: var(--mj-muted);
  font-size: var(--mj-player-content-font);
}

.mj-trait-slot-inner {
  font-size: var(--mj-player-content-font);
  line-height: 1.2;
  text-align: center;
  color: var(--mj-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
  max-width: 100%;
}

.mj-trait-slot[data-rarity="平庸"] {
  border-color: #808080;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25);
}
.mj-trait-slot[data-rarity="普通"] {
  border-color: #4caf50;
}
.mj-trait-slot[data-rarity="稀有"] {
  border-color: #4fc3f7;
}
.mj-trait-slot[data-rarity="史诗"] {
  border-color: #ba68c8;
}
.mj-trait-slot[data-rarity="传说"] {
  border-color: #e8c547;
}
.mj-trait-slot[data-rarity="神迹"] {
  border-color: #ff5252;
}
.mj-trait-slot[data-rarity="负面状态"] {
  border-color: #e57373;
}

.mj-trait-slot--filled {
  cursor: pointer;
}

.mj-trait-slot--filled:hover {
  background: rgba(232, 197, 71, 0.08);
}

.mj-trait-slot--filled:focus {
  outline: 2px solid var(--mj-gold);
  outline-offset: 1px;
}

/* 储物袋售卖确认：叠在物品详情之上 */
#mj-bag-sell-root.mj-trait-modal-root {
  z-index: 9100;
}

.mj-trait-modal-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.mj-trait-modal-root.hidden {
  display: none;
}

.mj-trait-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.mj-trait-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 18px 20px 16px;
  border-radius: 12px;
  border: 1px solid var(--mj-border);
  background: linear-gradient(180deg, rgba(32, 38, 34, 0.98), rgba(18, 22, 20, 0.98));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  color: var(--mj-text);
}

.mj-trait-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--mj-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.mj-trait-modal-close:hover {
  color: var(--mj-text);
  background: rgba(255, 255, 255, 0.1);
}

.mj-trait-modal-title {
  margin: 0 36px 6px 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--mj-gold);
  line-height: 1.35;
}

.mj-trait-modal-rarity {
  font-size: 0.78rem;
  color: var(--mj-gold-dim);
  margin-bottom: 12px;
}

.mj-trait-modal-body {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--mj-text);
}

/* NPC 详情：加宽面板，标题固定、正文滚动 */
.mj-trait-modal.mj-npc-detail-panel {
  max-width: min(440px, 96vw);
  max-height: min(88vh, 760px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mj-npc-detail-panel .mj-trait-modal-body.mj-npc-detail-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.mj-npc-detail-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.mj-npc-detail-avatar-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid rgba(232, 197, 71, 0.35);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  position: relative;
}

.mj-npc-detail-avatar-wrap:hover {
  border-color: rgba(232, 197, 71, 0.55);
}

.mj-npc-detail-avatar-wrap:focus {
  outline: 2px solid rgba(232, 197, 71, 0.45);
  outline-offset: 2px;
}

.mj-npc-detail-avatar-wrap:hover::after {
  content: "上传";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 0;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255, 245, 220, 0.95);
  background: rgba(0, 0, 0, 0.55);
}

.mj-npc-detail-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mj-npc-detail-avatar-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--mj-muted);
}

.mj-npc-detail-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mj-npc-detail-realm-big {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--mj-gold-dim);
  line-height: 1.4;
}

.mj-npc-detail-id-line {
  font-size: 0.72rem;
  color: var(--mj-muted);
  margin-top: 6px;
}

.mj-npc-detail-identity {
  margin-top: 4px;
  margin-bottom: 8px;
}

.mj-npc-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.mj-npc-detail-slot {
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 4px;
  font-size: 0.68rem;
  line-height: 1.3;
  text-align: center;
  word-break: break-all;
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mj-npc-detail-slot--empty {
  color: var(--mj-muted);
  opacity: 0.75;
}

.mj-npc-detail-slot--filled {
  color: var(--mj-text);
  background: rgba(255, 255, 255, 0.04);
}

/* NPC 详情 · 储物袋（与左栏 #mj-inventory-grid 同结构） */
#mj-npc-detail-bag-grid .mj-inventory-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 5px 18px;
  box-sizing: border-box;
}

#mj-npc-detail-bag-grid .mj-inventory-slot-label {
  font-size: var(--mj-player-content-font);
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--mj-text);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--empty .mj-inventory-slot-label {
  color: transparent;
}

#mj-npc-detail-bag-grid .mj-inventory-slot-qty {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: var(--mj-player-content-font);
  font-weight: 600;
  color: var(--mj-gold-dim);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled {
  border-style: solid;
  border-color: rgba(232, 197, 71, 0.35);
  background: rgba(232, 197, 71, 0.05);
  cursor: pointer;
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="平庸"] {
  border-color: #808080;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25);
  background: rgba(0, 0, 0, 0.28);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="普通"] {
  border-color: #b0b0b0;
  background: rgba(0, 0, 0, 0.28);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="稀有"] {
  border-color: #4fc3f7;
  background: rgba(79, 195, 247, 0.08);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="史诗"] {
  border-color: #ba68c8;
  background: rgba(186, 104, 200, 0.1);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="传说"] {
  border-color: #e8c547;
  background: rgba(232, 197, 71, 0.12);
}

#mj-npc-detail-bag-grid .mj-inventory-slot--filled[data-rarity="神迹"] {
  border-color: #ff5252;
  background: rgba(255, 82, 82, 0.12);
}

.mj-npc-detail-body .mj-player-bag-stack {
  margin-top: 6px;
}

/* 弹窗品质色：与左侧天赋槽 data-rarity 一致 */
.mj-trait-modal[data-rarity="平庸"] {
  border-color: #808080;
  box-shadow:
    0 0 0 1px rgba(128, 128, 128, 0.35),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(128, 128, 128, 0.12);
}
.mj-trait-modal[data-rarity="平庸"] .mj-trait-modal-title {
  color: #b0b0b0;
}
.mj-trait-modal[data-rarity="平庸"] .mj-trait-modal-rarity {
  color: #9e9e9e;
}

.mj-trait-modal[data-rarity="普通"] {
  border-color: #4caf50;
  box-shadow:
    0 0 0 1px rgba(76, 175, 80, 0.45),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(76, 175, 80, 0.14);
}
.mj-trait-modal[data-rarity="普通"] .mj-trait-modal-title {
  color: #66bb6a;
}
.mj-trait-modal[data-rarity="普通"] .mj-trait-modal-rarity {
  color: #9ccc65;
}

.mj-trait-modal[data-rarity="稀有"] {
  border-color: #4fc3f7;
  box-shadow:
    0 0 0 1px rgba(79, 195, 247, 0.45),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(79, 195, 247, 0.2);
}
.mj-trait-modal[data-rarity="稀有"] .mj-trait-modal-title {
  color: #81d4fa;
}
.mj-trait-modal[data-rarity="稀有"] .mj-trait-modal-rarity {
  color: #b3e5fc;
}

.mj-trait-modal[data-rarity="史诗"] {
  border-color: #ba68c8;
  box-shadow:
    0 0 0 1px rgba(186, 104, 200, 0.5),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(186, 104, 200, 0.28);
}
.mj-trait-modal[data-rarity="史诗"] .mj-trait-modal-title {
  color: #ce93d8;
}
.mj-trait-modal[data-rarity="史诗"] .mj-trait-modal-rarity {
  color: #e1bee7;
}

.mj-trait-modal[data-rarity="传说"] {
  border-color: #e8c547;
  box-shadow:
    0 0 0 1px rgba(232, 197, 71, 0.45),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(232, 197, 71, 0.22);
}
.mj-trait-modal[data-rarity="传说"] .mj-trait-modal-title {
  color: #ffe082;
}
.mj-trait-modal[data-rarity="传说"] .mj-trait-modal-rarity {
  color: #fff9c4;
}

.mj-trait-modal[data-rarity="神迹"] {
  border-color: #ff5252;
  box-shadow:
    0 0 0 1px rgba(255, 82, 82, 0.5),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(255, 82, 82, 0.25);
}
.mj-trait-modal[data-rarity="神迹"] .mj-trait-modal-title {
  color: #ff8a80;
}
.mj-trait-modal[data-rarity="神迹"] .mj-trait-modal-rarity {
  color: #ffcdd2;
}

.mj-trait-modal[data-rarity="负面状态"] {
  border-color: #e57373;
  box-shadow:
    0 0 0 1px rgba(229, 115, 115, 0.45),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(229, 115, 115, 0.18);
}
.mj-trait-modal[data-rarity="负面状态"] .mj-trait-modal-title {
  color: #ef9a9a;
}
.mj-trait-modal[data-rarity="负面状态"] .mj-trait-modal-rarity {
  color: #ffcdd2;
}

.mj-trait-modal-section {
  margin-top: 12px;
}

.mj-trait-modal-section:first-child {
  margin-top: 0;
}

.mj-trait-modal-k {
  display: block;
  font-size: 0.72rem;
  color: var(--mj-muted);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.mj-trait-modal-v {
  white-space: pre-wrap;
  word-break: break-word;
}

.mj-item-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mj-item-detail-action-btn {
  flex: 1;
  min-width: 88px;
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: var(--mj-text, #e8e4dc);
  cursor: pointer;
}

.mj-item-detail-action-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.mj-item-detail-action-btn--primary {
  border-color: rgba(129, 199, 132, 0.55);
  background: rgba(129, 199, 132, 0.12);
}

.mj-item-detail-action-btn--primary:hover {
  border-color: rgba(129, 199, 132, 0.85);
  background: rgba(129, 199, 132, 0.2);
}

.mj-item-detail-cultivate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mj-item-detail-cultivate-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.mj-item-detail-cultivate-label {
  font-size: 0.78rem;
  color: var(--mj-muted);
  white-space: nowrap;
}

.mj-item-detail-cultivate-input {
  flex: 1;
  min-width: 72px;
  max-width: 160px;
  padding: 6px 8px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: var(--mj-text, #e8e4dc);
}

.mj-item-detail-cultivate-input:focus {
  outline: none;
  border-color: rgba(129, 199, 132, 0.55);
}

/* 装备佩戴：储物袋上方，固定 4 槽（武器 / 法器 / 防具 / 载具），正方形格 */
.mj-equip-block {
  margin-top: 8px;
}

.mj-equip-block .mj-attr-section-title {
  margin-top: 14px;
  margin-bottom: 10px;
}

.mj-equip-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.mj-equip-slot {
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  padding: 5px 4px;
  border-radius: 6px;
  border: 1px solid rgba(140, 120, 83, 0.45);
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
}

.mj-equip-slot--empty {
  border-style: dashed;
  opacity: 0.85;
  cursor: default;
}

.mj-equip-slot--filled {
  border-style: solid;
  border-color: rgba(232, 197, 71, 0.55);
  background: rgba(232, 197, 71, 0.06);
  cursor: pointer;
}

.mj-equip-slot-k {
  font-size: var(--mj-player-content-font);
  color: var(--mj-muted);
  letter-spacing: 0.04em;
}

.mj-equip-slot-name {
  font-size: var(--mj-player-content-font);
  line-height: 1.2;
  color: var(--mj-text);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.mj-equip-slot--empty .mj-equip-slot-name {
  color: var(--mj-muted);
  font-size: var(--mj-player-content-font);
}

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

.mj-inventory-slot {
  aspect-ratio: 1;
  min-height: 36px;
  border: 1px dashed rgba(140, 120, 83, 0.4);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

/* 储物袋：名称居中，右下角数量 */
#mj-inventory-grid .mj-inventory-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 5px 18px;
  box-sizing: border-box;
}

#mj-inventory-grid .mj-inventory-slot-label {
  font-size: var(--mj-player-content-font);
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--mj-text);
}

#mj-inventory-grid .mj-inventory-slot--empty .mj-inventory-slot-label {
  color: transparent;
}

#mj-inventory-grid .mj-inventory-slot-qty {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: var(--mj-player-content-font);
  font-weight: 600;
  color: var(--mj-gold-dim);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

#mj-inventory-grid .mj-inventory-slot--lingshi {
  border-style: solid;
  border-color: rgba(180, 160, 90, 0.45);
  background: rgba(232, 197, 71, 0.06);
}

#mj-inventory-grid .mj-inventory-slot--lingshi .mj-inventory-slot-label {
  color: var(--mj-gold-dim);
  font-weight: 600;
}

#mj-inventory-grid .mj-inventory-slot--filled {
  border-style: solid;
  border-color: rgba(232, 197, 71, 0.35);
  background: rgba(232, 197, 71, 0.05);
}

/* 品阶：stuff_describe.grade → data-rarity（与 .mj-trait-slot 配色一致） */
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="平庸"],
.mj-equip-slot--filled[data-rarity="平庸"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="平庸"] {
  border-color: #808080;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25);
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="平庸"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="平庸"] {
  background: rgba(0, 0, 0, 0.28);
}
.mj-equip-slot--filled[data-rarity="平庸"] {
  background: rgba(0, 0, 0, 0.22);
}

#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="普通"],
.mj-equip-slot--filled[data-rarity="普通"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="普通"] {
  border-color: #4caf50;
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="普通"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="普通"] {
  background: rgba(0, 0, 0, 0.28);
}
.mj-equip-slot--filled[data-rarity="普通"] {
  background: rgba(0, 0, 0, 0.22);
}

#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="稀有"],
.mj-equip-slot--filled[data-rarity="稀有"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="稀有"] {
  border-color: #4fc3f7;
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="稀有"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="稀有"] {
  background: rgba(79, 195, 247, 0.08);
}
.mj-equip-slot--filled[data-rarity="稀有"] {
  background: rgba(79, 195, 247, 0.08);
}

#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="史诗"],
.mj-equip-slot--filled[data-rarity="史诗"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="史诗"] {
  border-color: #ba68c8;
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="史诗"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="史诗"] {
  background: rgba(186, 104, 200, 0.1);
}
.mj-equip-slot--filled[data-rarity="史诗"] {
  background: rgba(186, 104, 200, 0.1);
}

#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="传说"],
.mj-equip-slot--filled[data-rarity="传说"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="传说"] {
  border-color: #e8c547;
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="传说"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="传说"] {
  background: rgba(232, 197, 71, 0.12);
}
.mj-equip-slot--filled[data-rarity="传说"] {
  background: rgba(232, 197, 71, 0.12);
}

#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="神迹"],
.mj-equip-slot--filled[data-rarity="神迹"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="神迹"] {
  border-color: #ff5252;
}
#mj-inventory-grid .mj-inventory-slot--filled[data-rarity="神迹"],
.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled[data-rarity="神迹"] {
  background: rgba(255, 82, 82, 0.12);
}
.mj-equip-slot--filled[data-rarity="神迹"] {
  background: rgba(255, 82, 82, 0.12);
}

/* 功法：格子 flex 居中；名称 + 类型（辅助/攻击）纵向叠放 */
.mj-gongfa-grid .mj-inventory-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 5px;
  box-sizing: border-box;
  cursor: default;
}

.mj-gongfa-grid .mj-gongfa-slot-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 100%;
  gap: 2px;
  pointer-events: none;
}

.mj-gongfa-grid .mj-gongfa-slot-type {
  font-size: 0.62rem;
  line-height: 1.15;
  font-weight: 600;
  color: var(--mj-muted);
  flex-shrink: 0;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mj-gongfa-grid .mj-gongfa-slot-type--support {
  color: #81c784;
}

.mj-gongfa-grid .mj-gongfa-slot-type--attack {
  color: #e57373;
}

.mj-gongfa-grid .mj-gongfa-slot-type--other {
  color: var(--mj-gold-dim);
}

.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled {
  cursor: pointer;
}

.mj-gongfa-grid .mj-gongfa-slot-label {
  width: 100%;
  max-height: 100%;
  font-size: var(--mj-player-content-font);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--mj-text);
  pointer-events: none;
}

.mj-gongfa-grid .mj-inventory-slot.mj-gongfa-slot--filled {
  border-style: solid;
  border-color: rgba(232, 197, 71, 0.5);
  background: rgba(232, 197, 71, 0.06);
}

#mj-inventory-grid .mj-inventory-slot--filled,
#mj-inventory-grid .mj-inventory-slot--lingshi {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* 中栏 · 聊天 */
.mj-pane--chat {
  background: rgba(12, 16, 14, 0.65);
}

.mj-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--mj-chat-bg);
}

.mj-chat-placeholder {
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  color: var(--mj-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* 剧情区 · 开局总览（首条系统消息） */
.mj-chat-msg--overview {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--mj-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.38);
  text-align: left;
  color: var(--mj-text);
  font-size: 0.88rem;
  line-height: 1.55;
}

.mj-chat-overview-title {
  margin: 0 0 10px;
  font-size: 1.02rem;
  color: var(--mj-gold);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mj-chat-overview-intro {
  margin: 0 0 4px;
  color: var(--mj-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.mj-chat-overview-intro p {
  margin: 0 0 8px;
}

.mj-chat-overview-intro p:last-child {
  margin-bottom: 0;
}

.mj-chat-overview-h {
  margin: 16px 0 8px;
  font-size: 0.92rem;
  color: rgba(232, 197, 71, 0.9);
  font-weight: 600;
  border-bottom: 1px solid rgba(140, 120, 83, 0.28);
  padding-bottom: 5px;
}

.mj-chat-overview-h:first-of-type {
  margin-top: 10px;
}

.mj-chat-overview-dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(4.5em, auto) 1fr;
  gap: 6px 14px;
  font-size: 0.86rem;
}

.mj-chat-overview-dl dt {
  margin: 0;
  color: var(--mj-muted);
  font-weight: normal;
}

.mj-chat-overview-dl dd {
  margin: 0;
  word-break: break-word;
}

.mj-chat-overview-muted {
  margin: 6px 0 0;
  color: var(--mj-muted);
  font-size: 0.86rem;
}

.mj-chat-overview-ul {
  margin: 8px 0 0;
  padding-left: 1.15em;
}

.mj-chat-overview-li {
  margin-bottom: 10px;
}

.mj-chat-overview-li strong {
  color: rgba(255, 235, 190, 0.95);
  font-weight: 600;
}

.mj-chat-overview-sub {
  color: rgba(220, 218, 210, 0.92);
  font-size: 0.9em;
}

.mj-chat-overview-effect {
  color: var(--mj-muted);
  font-size: 0.88em;
}

.mj-chat-msg--role {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mj-chat-msg--user {
  margin-left: 12%;
  background: rgba(60, 90, 70, 0.45);
  border: 1px solid rgba(120, 160, 130, 0.35);
}

.mj-chat-msg--assistant {
  margin-right: 8%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--mj-border);
}

/** 剧情 AI 成功返回但正文为空时的提示气泡 */
.mj-chat-msg--assistant.mj-chat-msg--assistant-empty {
  background: rgba(90, 55, 35, 0.42);
  border: 1px solid rgba(200, 120, 70, 0.45);
  color: #e8c4a0;
}

.mj-chat-msg--assistant.mj-chat-msg--assistant-empty .mj-chat-role-label {
  color: rgba(220, 160, 120, 0.88);
}

.mj-chat-msg--error {
  margin-right: 8%;
  background: rgba(120, 40, 40, 0.35);
  border: 1px solid rgba(200, 80, 80, 0.45);
  color: #f0c0c0;
}

.mj-chat-msg-retry-row {
  margin-top: 10px;
}

.mj-chat-retry-btn {
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(232, 197, 71, 0.55);
  background: rgba(45, 55, 42, 0.85);
  color: var(--mj-gold, #e8c547);
}

.mj-chat-retry-btn:hover:not(:disabled) {
  background: rgba(55, 68, 50, 0.92);
  border-color: rgba(232, 197, 71, 0.75);
}

.mj-chat-retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/** 程序战斗结束后的伤害统计气泡 */
.mj-chat-msg--battle-settlement {
  margin-right: 6%;
  background: rgba(55, 48, 78, 0.42);
  border: 1px solid rgba(160, 140, 200, 0.4);
  color: #e6e0f5;
}

.mj-chat-msg--battle-settlement .mj-chat-role-label {
  color: rgba(200, 185, 235, 0.92);
}

/** 战斗胜利后入袋的装备 / 功法摘要（介于结算与剧情之间） */
.mj-chat-msg--battle-loot {
  margin-right: 8%;
  background: rgba(38, 62, 48, 0.48);
  border: 1px solid rgba(120, 175, 130, 0.45);
  color: #e4f0e6;
}

.mj-chat-msg--battle-loot .mj-chat-role-label {
  color: rgba(165, 210, 175, 0.95);
}

.mj-chat-role-label {
  display: block;
  font-size: 0.72rem;
  color: var(--mj-muted);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

/* 剧情请求状态（等待 / 流式 / 完成 / 失败） */
.mj-chat-status {
  flex-shrink: 0;
  min-height: 1.4em;
  padding: 6px 16px 4px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--mj-muted);
  border-top: 1px solid rgba(140, 120, 83, 0.2);
  background: rgba(0, 0, 0, 0.18);
  transition: color 0.2s ease;
}

.mj-chat-status--idle:empty {
  padding-top: 0;
  padding-bottom: 0;
  min-height: 0;
  border-top-color: transparent;
  background: transparent;
}

.mj-chat-status--waiting {
  color: var(--mj-gold);
}

.mj-chat-status--streaming {
  color: #9ec5e8;
}

.mj-chat-status--done {
  color: #81c784;
}

.mj-chat-status--error {
  color: #e57373;
}

/* 剧情生成 / 状态更新：各保留最新一条完成记录 */
.mj-ai-process-log-wrap {
  flex-shrink: 0;
  border-top: 1px solid rgba(140, 120, 83, 0.15);
  background: rgba(0, 0, 0, 0.22);
}

.mj-ai-process-log {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px 8px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(232, 215, 170, 0.88);
  font-variant-numeric: tabular-nums;
}

.mj-ai-process-log__line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mj-ai-process-log__line--done {
  color: #a5d6a7;
}

.mj-ai-process-log__line--error {
  color: #ef9a9a;
}

.mj-chat-suggestion-wrap {
  flex-shrink: 0;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(140, 120, 83, 0.15);
  background: rgba(0, 0, 0, 0.22);
}

.mj-chat-suggestion-toggle-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 5px 0;
  border-top: 1px solid rgba(140, 120, 83, 0.15);
  background: rgba(0, 0, 0, 0.22);
}

.mj-chat-suggestion-toggle-btn {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(187, 152, 93, 0.45);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 236, 195, 0.18), transparent 45%),
    linear-gradient(180deg, rgba(102, 81, 47, 0.92), rgba(70, 55, 31, 0.92));
  color: rgba(248, 234, 201, 0.96);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.72rem;
  box-shadow:
    0 0 0 1px rgba(20, 14, 8, 0.45) inset,
    0 1px 4px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.16s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    filter 0.2s ease;
}

.mj-chat-suggestion-toggle-btn:hover {
  border-color: rgba(216, 178, 106, 0.62);
  box-shadow:
    0 0 0 1px rgba(36, 26, 15, 0.5) inset,
    0 0 0 3px rgba(232, 197, 71, 0.14),
    0 4px 10px rgba(0, 0, 0, 0.34);
  filter: brightness(1.05);
}

.mj-chat-suggestion-toggle-btn:active {
  transform: translateY(1px) scale(0.98);
}

.mj-chat-suggestion-toggle-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px rgba(36, 26, 15, 0.5) inset,
    0 0 0 3px rgba(232, 197, 71, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.34);
}

.mj-chat-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mj-chat-suggestion-btn {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(159, 132, 84, 0.45);
  border-radius: 8px;
  background: rgba(56, 44, 27, 0.55);
  color: rgba(238, 224, 191, 0.94);
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.12s ease;
}

.mj-chat-suggestion-btn:hover {
  background: rgba(82, 64, 38, 0.75);
  border-color: rgba(193, 158, 97, 0.58);
}

.mj-chat-suggestion-btn:active {
  transform: translateY(1px);
}

.mj-chat-composer {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--mj-border);
  background: rgba(0, 0, 0, 0.35);
}

.mj-chat-composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--mj-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--mj-text);
  font-family: inherit;
  font-size: 0.9rem;
}

.mj-chat-composer textarea::placeholder {
  color: var(--mj-muted);
}

.mj-chat-composer textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mj-chat-composer button {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 10px 18px;
  border: 1px solid var(--mj-border);
  border-radius: 8px;
  background: rgba(232, 197, 71, 0.12);
  color: var(--mj-gold);
  font-size: 0.9rem;
  cursor: pointer;
}

.mj-chat-composer button:hover {
  background: rgba(232, 197, 71, 0.22);
}

.mj-chat-composer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 右栏 · 周围人物：正文区占满顶栏与「返回主界面」之间的空间，列表在区内滚动 */
.mj-pane-body.mj-npc-panel-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-top: 8px;
}

.mj-npc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.mj-npc-card {
  padding: 10px 12px;
  border: 1px solid var(--mj-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

button.mj-npc-card.mj-npc-card--sheet {
  width: 100%;
  margin: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.mj-npc-card.mj-npc-card--sheet:hover {
  border-color: rgba(232, 197, 71, 0.55);
  background: rgba(0, 0, 0, 0.28);
}

button.mj-npc-card.mj-npc-card--sheet:focus-visible {
  outline: 2px solid var(--mj-gold);
  outline-offset: 2px;
}

.mj-npc-card--sheet {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

button.mj-npc-card.mj-npc-card--dead {
  background: rgba(35, 28, 32, 0.65);
  border-color: rgba(120, 70, 80, 0.55);
  opacity: 0.88;
}

button.mj-npc-card.mj-npc-card--dead:hover {
  border-color: rgba(160, 90, 100, 0.55);
  background: rgba(40, 32, 36, 0.72);
}

.mj-npc-card-dead-tag {
  margin-left: 6px;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(90, 45, 52, 0.75);
  color: #e8b4bc;
  vertical-align: middle;
}

.mj-npc-detail-dead-banner {
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  background: rgba(70, 38, 44, 0.55);
  border: 1px solid rgba(150, 80, 90, 0.45);
  color: #ecc6cc;
}

.mj-npc-card-lead {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 64px;
}

.mj-npc-card-realm-below {
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(232, 197, 71, 0.92);
  text-align: center;
  width: 100%;
  word-break: break-all;
}

.mj-npc-card-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 1px solid rgba(232, 197, 71, 0.35);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--mj-muted);
  text-align: center;
  line-height: 1.2;
}

.mj-npc-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mj-npc-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mj-npc-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mj-gold-dim);
  line-height: 1.35;
  word-break: break-all;
}

.mj-npc-card-title .mj-npc-name {
  color: var(--mj-gold);
}

/* NPC 血/法：与左栏相同的横向 .mj-bar */
.mj-npc-bars-h {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mj-npc-resource-row {
  margin-bottom: 0;
}

.mj-npc-resource-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--mj-muted);
  margin-bottom: 3px;
}

.mj-npc-resource-nums {
  font-size: 0.72rem;
  color: var(--mj-gold);
  font-variant-numeric: tabular-nums;
}

.mj-npc-card h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--mj-gold-dim);
}

.mj-npc-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--mj-muted);
  line-height: 1.45;
}

@media (max-width: 900px) {
  .mj-main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .mj-pane {
    border-right: none;
    border-bottom: 1px solid var(--mj-border);
    max-height: 40vh;
  }

  .mj-pane--chat {
    max-height: none;
    min-height: 50vh;
  }

  .mj-pane:last-child {
    border-bottom: none;
  }
}

@media (max-width: 640px) {
  .mj-chat-suggestion-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  *::-webkit-scrollbar {
    width: 3px;
    height: 3px;
  }
}

/* 手机端适配：默认隐藏两侧；在剧情区标题栏提供切换按钮 */
@media (max-width: 640px) {
  .mj-main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  /* 覆盖 <=900px 的堆叠限制：手机模式由弹出侧栏承担 */
  .mj-pane {
    max-height: none;
  }

  .mj-pane--player,
  .mj-pane--npc {
    display: none !important;
  }

  .mj-pane--chat {
    border-bottom: none;
  }

  .mj-chat-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mj-chat-pane-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    color: var(--mj-gold-dim);
    font-weight: 600;
  }

  .mj-mobile-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(0, 0, 0, 0.35);
    color: var(--mj-gold);
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mj-mobile-open-btn:hover {
    border-color: rgba(255, 215, 120, 0.65);
    background: rgba(55, 42, 12, 0.45);
  }

  .mj-mobile-panel-close {
    display: none;
  }

  /* 两侧弹出面板 */
  .mj-pane--player.mj-mobile-open,
  .mj-pane--npc.mj-mobile-open {
    display: flex !important;
    position: fixed;
    top: 56px; /* 覆盖 header（mj-main-header）高度 */
    bottom: 0;
    z-index: 2500;
    max-height: none !important;
    width: min(92vw, 340px);
    border-bottom: none;
    overflow: hidden;
  }

  .mj-pane--player.mj-mobile-open {
    left: 0;
    border-right: 1px solid var(--mj-border);
  }

  .mj-pane--npc.mj-mobile-open {
    right: 0;
    border-right: none;
    border-left: 1px solid var(--mj-border);
    width: min(92vw, 320px);
  }

  .mj-pane--player.mj-mobile-open .mj-mobile-panel-close,
  .mj-pane--npc.mj-mobile-open .mj-mobile-panel-close {
    display: inline-flex;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: var(--mj-gold);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
  }

  .mj-mobile-open-btn:focus-visible,
  .mj-mobile-panel-close:focus-visible {
    outline: 2px solid rgba(232, 197, 71, 0.55);
    outline-offset: 2px;
  }

  /* 默认隐藏时，先把两个按钮隐去，避免桌面看到 */
  /* 显示在手机 */
  .mj-chat-pane-header .mj-mobile-open-btn {
    display: inline-flex;
  }

  /* 让侧栏内部标题栏更紧凑一点 */
  .mj-pane--player.mj-mobile-open .mj-pane-header,
  .mj-pane--npc.mj-mobile-open .mj-pane-header {
    padding-right: 48px; /* 给关闭按钮留空 */
  }
}

/* —— 开局 AI 门闩（新档首次进入主界面前） —— */
.mj-bootstrap-ai-gate {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 10, 9, 0.92);
  backdrop-filter: blur(6px);
}

.mj-bootstrap-ai-gate.hidden {
  display: none !important;
}

body.mj-main-body--bootstrap-gate .mj-main-header,
body.mj-main-body--bootstrap-gate #mj-main-layout {
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.2) brightness(0.55);
}

.mj-bootstrap-ai-gate__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: min(90vh, 640px);
  overflow: auto;
  padding: 22px 22px 18px;
  border-radius: 12px;
  border: 1px solid var(--mj-border);
  background: var(--mj-panel-bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.mj-bootstrap-ai-gate__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mj-bootstrap-ai-gate__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--mj-gold);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.mj-bootstrap-ai-gate__cancel {
  flex-shrink: 0;
  margin: -4px -6px 0 0;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(140, 120, 83, 0.5);
  background: rgba(0, 0, 0, 0.22);
  color: var(--mj-muted);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.mj-bootstrap-ai-gate__cancel:hover {
  color: var(--mj-text);
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(232, 197, 71, 0.35);
}

.mj-bootstrap-ai-gate__hint {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--mj-muted);
  line-height: 1.55;
}

.mj-bootstrap-ai-gate__rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mj-bootstrap-ai-gate__row {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(140, 120, 83, 0.28);
  background: rgba(0, 0, 0, 0.2);
}

.mj-bootstrap-ai-gate__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mj-text);
  margin-bottom: 8px;
}

.mj-bootstrap-ai-gate__times {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.82rem;
  color: var(--mj-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.mj-bootstrap-ai-gate__status {
  font-size: 0.84rem;
  color: var(--mj-gold-dim);
}

.mj-bootstrap-ai-gate__error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(120, 40, 40, 0.35);
  border: 1px solid rgba(200, 80, 80, 0.45);
  color: #f0c0c0;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.mj-bootstrap-ai-gate__actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mj-bootstrap-ai-gate__btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(232, 197, 71, 0.45);
  background: rgba(232, 197, 71, 0.18);
  color: var(--mj-gold);
  font-size: 0.88rem;
  cursor: pointer;
}

.mj-bootstrap-ai-gate__btn:hover {
  background: rgba(232, 197, 71, 0.28);
}

.mj-bootstrap-ai-gate__btn--secondary {
  border-color: rgba(140, 120, 83, 0.5);
  background: rgba(0, 0, 0, 0.22);
  color: var(--mj-muted);
}

.mj-bootstrap-ai-gate__btn--secondary:hover {
  color: var(--mj-text);
  background: rgba(0, 0, 0, 0.35);
}
