/* ==========================================================================
   古风特色组件样式：模态弹窗、圣旨、奏折、书信、地图、关系图、浮生传
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 5, 8, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.modal-container {
  width: 100%;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 0.32s var(--ease-silk);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(207, 169, 98, 0.3);
}

.modal-title {
  margin: 0;
  font-family: var(--font-calligraphy);
  font-size: 28px;
  color: var(--gold-light);
  letter-spacing: 0.12em;
}

.paper-panel .modal-title {
  color: var(--cinnabar-deep);
}

.modal-close {
  background: none;
  border: 1px solid rgba(207, 169, 98, 0.4);
  color: var(--gold-light);
  font-size: 18px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-panel .modal-close {
  color: var(--cinnabar-deep);
  border-color: var(--gold-dim);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

.modal-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(207, 169, 98, 0.25);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.modal-tab {
  padding: 6px 14px;
  font-size: 13px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-serif);
}

.modal-tab.active {
  color: var(--gold-light);
  border-color: var(--gold);
  background: rgba(143, 36, 36, 0.35);
}

/* ==========================================================================
   圣旨全屏仪式层
   ========================================================================== */
.decree-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 5, 5, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.35s ease;
}

.decree-scroll {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, #e5c16c 0%, #f5df9c 15%, #f7e6b5 85%, #d6aa4e 100%);
  color: #2b1a0c;
  border-top: 14px solid #7a1c1c;
  border-bottom: 14px solid #7a1c1c;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), inset 0 0 36px rgba(150, 95, 20, 0.35);
  padding: 32px 36px;
  text-align: center;
  animation: scrollUnfurl 0.55s var(--ease-silk);
}

.decree-heading {
  font-family: var(--font-calligraphy);
  font-size: 38px;
  color: #7a1c1c;
  letter-spacing: 0.35em;
  margin: 0 0 16px;
}

.decree-body {
  font-size: 16px;
  line-height: 2;
  text-align: left;
  text-indent: 2em;
  margin-bottom: 24px;
}

.decree-seal {
  display: inline-block;
  border: 2px solid #9c1f1f;
  color: #9c1f1f;
  padding: 6px 12px;
  font-family: var(--font-calligraphy);
  font-size: 20px;
  margin-bottom: 20px;
}

/* ==========================================================================
   古风 Toast 提示
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 440px);
}

.toast-item {
  padding: 10px 18px;
  background: rgba(18, 14, 16, 0.94);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--cinnabar-bright);
  color: var(--paper);
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow-deep);
  animation: fadeUp 0.3s var(--ease-silk);
}

/* ==========================================================================
   宫廷舆图 SVG
   ========================================================================== */
.map-canvas-wrap {
  position: relative;
  width: 100%;
  background: radial-gradient(circle at center, #2a211b 0%, #161210 100%);
  border: 1px solid rgba(207, 169, 98, 0.38);
  padding: 12px;
}

.map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-node {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.map-node:hover .map-node-box {
  fill: rgba(143, 36, 36, 0.85);
  stroke: #ebd39c;
}

.map-detail-bar {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(20, 18, 22, 0.82);
  border: var(--border-gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ==========================================================================
   人物档案与关系图谱
   ========================================================================== */
.npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.npc-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(25, 22, 26, 0.82);
  border: 1px solid rgba(207, 169, 98, 0.25);
  cursor: pointer;
  transition: all 0.22s ease;
}

.npc-card:hover {
  border-color: var(--gold-light);
  background: rgba(45, 28, 28, 0.78);
}

.npc-card-avatar {
  width: 56px;
  height: 72px;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--gold-dim);
  flex-shrink: 0;
  background: #1b181c;
}

.npc-card-avatar-fallback {
  width: 56px;
  height: 72px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #322121, #19161b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-calligraphy);
  font-size: 26px;
  color: var(--gold-light);
  flex-shrink: 0;
}

.npc-card-info {
  flex: 1;
  min-width: 0;
}

.npc-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  justify-content: space-between;
}

.npc-card-title {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 6px;
}

.npc-relation-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid rgba(207, 169, 98, 0.35);
  color: var(--paper);
}

/* 线索卷宗 / 书信 / 奏折 / 存档槽 */
.dossier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dossier-item {
  padding: 14px 16px;
  background: rgba(244, 236, 224, 0.06);
  border: 1px solid rgba(207, 169, 98, 0.28);
}

.paper-panel .dossier-item {
  background: rgba(139, 109, 59, 0.08);
  border-color: rgba(139, 109, 59, 0.35);
}

.save-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(22, 19, 24, 0.85);
  border: 1px solid rgba(207, 169, 98, 0.3);
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   结局与《浮生传》视图
   ========================================================================== */
.view-ending {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 20px;
  overflow-y: auto;
}

.ending-card {
  width: 100%;
  max-width: 860px;
  padding: 32px 38px;
  margin: auto 0;
  animation: fadeUp 0.7s var(--ease-silk);
}

.ending-cg-frame {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border: 2px solid var(--gold);
  margin-bottom: 22px;
  box-shadow: var(--shadow-deep);
}

.biography-book {
  margin-top: 22px;
  padding: 24px 28px;
}

.biography-chapter {
  margin-bottom: 14px;
  padding-left: 14px;
  border-left: 2px solid var(--cinnabar);
}
