/* ============================================================
   2026-12 内廷名册 / 人物面板视觉收口
   仅覆盖样式，不改动按钮数量与文案。
   ============================================================ */

/* ---------- 一、内廷男妃名册 ---------- */
#consort-view .consort-list-header {
  position: relative;
  margin: 0 0 1.15rem;
  padding: 0.55rem 0 0.7rem;
}

#consort-view .consort-list-header h2 {
  position: relative;
  padding-left: 16px;
  color: #2B241C;
  font-size: 1.5rem;
  letter-spacing: 0.18em;
}

#consort-view .consort-list-header h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 20px;
  transform: translateY(-50%);
  background: #8B6F4F;
}

#consort-view .consort-count {
  display: inline;
  color: #8A7A66;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

#consort-view .consort-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.1rem;
}

#consort-view .consort-card {
  position: relative;
  padding: 6px;
  text-align: left;
  background: #FBF8F1;
  border: 1px solid #D6CBBF;
  border-radius: 2px;
  box-shadow: 0 10px 24px -22px rgba(43, 36, 28, 0.85);
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0.28, 1),
              box-shadow 0.35s cubic-bezier(0.22, 0.68, 0.28, 1),
              border-color 0.3s;
}

#consort-view .consort-card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(214, 203, 191, 0.55);
  pointer-events: none;
}

:where(html:not(.touch-device)) #consort-view .consort-card:hover {
  transform: translateY(-4px);
  border-color: #C2B29C;
  box-shadow: 0 24px 42px -26px rgba(43, 36, 28, 0.75);
}

#consort-view .consort-card-img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  margin: 0;
  overflow: hidden;
  background: #EAE3D5;
}

#consort-view .consort-card-img .portrait-fg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

#consort-view .consort-card-name {
  margin-top: 10px;
  padding: 0 4px;
  text-align: center;
  color: #3A2F24;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

#consort-view .consort-card-rank,
#consort-view .consort-card-palace {
  text-align: center;
  color: #8A7A66;
  letter-spacing: 0.06em;
}

#consort-view .consort-card-rank {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
}

#consort-view .consort-card-palace {
  margin-top: 0.15rem;
  padding-bottom: 4px;
  font-size: 0.74rem;
}

/* ---------- 二、人物面板：书页质感与边缘 ---------- */
.char-sheet .consort-info,
.char-sheet .folk-info,
.char-sheet .official-info {
  background:
    linear-gradient(90deg, rgba(203, 189, 170, 0.34) 0, rgba(251, 248, 241, 0) 18px),
    linear-gradient(180deg, #FCF9F2 0%, #F6F1E6 100%);
  border: 1px solid #D6CBBF;
  border-radius: 3px 7px 7px 3px;
  box-shadow:
    0 22px 54px -26px rgba(43, 36, 28, 0.5),
    6px 6px 0 -1px #EFE8DA,
    12px 12px 0 -2px #E5DBC9;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 111, 79, 0.45) transparent;
}

.char-sheet .consort-info::-webkit-scrollbar,
.char-sheet .folk-info::-webkit-scrollbar,
.char-sheet .official-info::-webkit-scrollbar {
  width: 8px;
}

.char-sheet .consort-info::-webkit-scrollbar-thumb,
.char-sheet .folk-info::-webkit-scrollbar-thumb,
.char-sheet .official-info::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 79, 0.35);
  border-radius: 8px;
}

/* 属性：两列，标签与值一律左对齐，行距统一 */
.char-sheet .props {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.4rem;
  align-content: start;
}

.char-sheet .row {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr);
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.46rem 0;
  border-bottom: none;
}

.char-sheet .row dt {
  margin: 0;
  color: #8A7A66;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-align: left;
}

.char-sheet .row dd {
  min-width: 0;
  margin: 0;
  color: #3A2F24;
  font-size: 0.82rem;
  line-height: 1.7;
  word-break: break-word;
}

.char-sheet .row.wide {
  grid-column: 1 / -1;
}

.char-sheet .row.wide dd {
  line-height: 1.9;
}

.char-sheet .row dd.private {
  color: #c9a0b0;
  font-style: italic;
}

/* 男妃四维：描述在前，数值用括号小字 */
.char-sheet .row dd .stat-num {
  margin-left: 0.1em;
  color: #8A7A66;
  font-size: 0.7rem;
  font-style: normal;
  letter-spacing: 0;
}

/* 档案四行：弱化为小字灰调，末行收一道细金线 */
.char-sheet .row.profile {
  padding: 0.22rem 0;
  border-bottom: none;
}
.char-sheet .row.profile dt {
  font-size: 0.68rem;
  color: #9A8B77;
  letter-spacing: 0.08em;
}
.char-sheet .row.profile dd {
  font-size: 0.8rem;
  color: #5E5243;
}
.char-sheet .row.profile dd .stat-num {
  font-size: 0.68rem;
  color: #A09380;
}
.char-sheet .row.profile dd.favor-value {
  color: #8A6B38;
  font-weight: 600;
}
.char-sheet .props > .row.profile:nth-child(4) {
  padding-bottom: 0.9rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(176, 141, 87, 0.28);
}

/* 性情 / 心境：普通条目，不再加浅金卡片 */
.char-sheet .row.state {
  margin: 0;
  padding: 0.46rem 0;
  border: none;
  border-radius: 0;
  background: none;
}
.char-sheet .row.state dt {
  color: #8A7A66;
  font-weight: 400;
}
.char-sheet .row.state dd {
  font-size: 0.82rem;
  color: #3A2F24;
}

/* 性情内容：金色高亮 */
.char-sheet .row dd.persona-value,
.char-sheet .attr-row span.persona-value {
  color: var(--gold-dark, #8a6b38);
}

/* 四维数值：两列排布即成 2 行 2 列，与普通字段同字号、不加高亮 */
.char-sheet .row.stats {
  padding: 0.5rem 0;
  grid-template-columns: 3.2em minmax(0, 1fr);
}
.char-sheet .row.stats dd {
  font-size: 0.82rem;
  font-weight: 400;
}
.char-sheet .row.stats dd .stat-num {
  color: #8A7A66;
  font-weight: 400;
}
/* 数值区上下各留一段空白，与其他字段分开（四格成对加，避免左右两列错行） */
.char-sheet .props > .row.stats:nth-child(7),
.char-sheet .props > .row.stats:nth-child(8) {
  margin-top: 0.55rem;
}
.char-sheet .props > .row.stats:nth-child(9),
.char-sheet .props > .row.stats:nth-child(10) {
  margin-bottom: 0.55rem;
}

/* 心境入口：标签靠左，按钮整行居中 */
.char-sheet .props > .row.state:has(.mood-view-btn) {
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}
.char-sheet .props > .row.state:has(.mood-view-btn) dt {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
.char-sheet .props > .row.state:has(.mood-view-btn) dd {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* 兄弟姐妹：标签靠左，内容整行居中 */
.char-sheet .props > .row.kin-center {
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}
.char-sheet .props > .row.kin-center dt {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
.char-sheet .props > .row.kin-center dd {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.1rem 0.6rem;
  width: 100%;
}

/* 亲属姓名：姓名 + 下划线，不再用胶囊 */
.char-sheet .row dd button.like-tag.parent-open {
  padding: 0;
  margin: 0 0.1rem;
  border: none;
  border-radius: 0;
  background: none;
  color: #6E5330;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}
.char-sheet .row dd button.like-tag.parent-open:hover {
  background: none;
  color: #8A6B38;
}

/* 子嗣立绘卡 */
.char-sheet .row dd .kin-mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.6rem;
}
.char-sheet .kin-mini-card {
  width: 56px;
  padding: 0;
}
.char-sheet .kin-mini-card img {
  width: 56px;
  height: 74px;
  object-fit: cover;
}

/* 面板内可点击小控件：统一描边胶囊，去掉浏览器默认按钮外观 */
.char-sheet .mood-view-btn,
.char-sheet .kin-btn,
.char-sheet button.like-tag,
.char-sheet button.hate-tag {
  border: 1px solid #C9B48C;
  border-radius: 100px;
  background: rgba(255, 251, 242, 0.75);
  color: #7A5E36;
  font-size: 0.64rem;
  line-height: 1.6;
  padding: 0.05rem 0.55rem;
  letter-spacing: 0.05em;
  box-shadow: none;
  vertical-align: middle;
  cursor: pointer;
}
.char-sheet .mood-view-btn:hover,
.char-sheet .kin-btn:hover,
.char-sheet button.like-tag:hover,
.char-sheet button.hate-tag:hover {
  background: #8A6B38;
  border-color: #8A6B38;
  color: #FBF7EF;
}

/* 兄弟姐妹小窗：放宽面板，立绘卡从左排起 */
.kin-sibs-panel {
  width: min(520px, 92vw);
}
.kin-sibs-body .kin-mini-grid {
  justify-content: flex-start;
}

/* 兜底：未被转换的属性行 */
.char-sheet .attr-row {
  grid-template-columns: 4em minmax(0, 1fr) 4em minmax(0, 1fr);
  gap: 0.3rem 0.8rem;
  padding: 0.45rem 0.1rem;
}

.char-sheet .attr-row.wide {
  grid-template-columns: 4.8em minmax(0, 1fr);
}

.char-sheet .attr-row b {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.char-sheet .attr-row span {
  overflow-wrap: anywhere;
}

/* 工具栏已不用，保留兜底隐藏 */
.char-sheet .attr-toolbar {
  display: none;
}

/* ---------- 三、人际：进度条 + 数值 ---------- */
.tie-meter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0 0.28rem;
}

.tie-meter .tie-bar {
  flex: 1;
  height: 6px;
  margin: 0;
  background: rgba(120, 100, 76, 0.14);
  border-radius: 3px;
}

.tie-score {
  min-width: 2.6em;
  text-align: right;
  color: #8A7A66;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.tie-hate .tie-score,
.tie-feud .tie-score {
  color: #A84848;
}

.tie-close .tie-score,
.tie-warm .tie-score {
  color: #5A8A4A;
}

/* ---------- 四、对谈：气泡 + 明显输入框 ---------- */
.char-sheet .talk-log {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem 0.1rem;
  background: transparent;
  border: none;
}

.char-sheet .talk-line {
  max-width: 84%;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
}

.char-sheet .talk-line.npc {
  align-self: flex-start;
  padding: 0.55rem 0.85rem;
  color: #2B241C;
  background: #FBF8F1;
  border: 1px solid #E2D7C6;
  border-radius: 3px 12px 12px 12px;
  box-shadow: 0 6px 14px -12px rgba(43, 36, 28, 0.6);
}

.char-sheet .talk-line.user {
  align-self: flex-end;
  padding: 0.55rem 0.85rem;
  color: #FBF7EF;
  text-align: left;
  background: #6B5642;
  border: 1px solid #6B5642;
  border-radius: 12px 3px 12px 12px;
}

.char-sheet .talk-line.sys {
  align-self: center;
  max-width: 100%;
  padding: 0.12rem 0.3rem;
  color: #8B6F4F;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: center;
  background: transparent;
  border: none;
}

.char-sheet .talk-line.date {
  align-self: stretch;
  max-width: 100%;
}

.char-sheet .talk-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.char-sheet .talk-row input {
  flex: 1;
  min-width: 0;
  height: 2.9rem;
  padding: 0 0.95rem;
  color: #2B241C;
  font-size: 0.95rem;
  background: #FFFDF8;
  border: 1px solid #C9B99A;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(43, 36, 28, 0.06);
}

.char-sheet .talk-row input::placeholder {
  color: #A79A88;
}

.char-sheet .talk-row input:focus {
  outline: none;
  border-color: #8B6F4F;
  box-shadow: 0 0 0 3px rgba(139, 111, 79, 0.12);
}

.char-sheet .talk-row .btn-primary {
  min-height: 2.9rem;
  padding: 0 1.4rem;
  color: #FBF8F1;
  letter-spacing: 0.14em;
  background: #6B5642;
  border: 1px solid #6B5642;
  border-radius: 3px;
}

/* ---------- 五、三端收口 ---------- */
@media (max-width: 1100px) {
  .char-sheet .props {
    column-gap: 1.5rem;
  }
  .char-sheet .row {
    grid-template-columns: 3.2em minmax(0, 1fr);
    gap: 0.4rem;
  }
  .char-sheet .attr-row {
    grid-template-columns: 3.6em minmax(0, 1fr) 3.6em minmax(0, 1fr);
  }
  .char-sheet .attr-row.wide {
    grid-template-columns: 4.4em minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .char-sheet .props {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
  }
  .char-sheet .row {
    grid-template-columns: 3.2em minmax(0, 1fr);
    gap: 0.4rem;
  }
  .char-sheet .talk-line {
    max-width: 88%;
  }
  .char-sheet .talk-row input,
  .char-sheet .talk-row .btn-primary {
    height: 2.5rem;
    min-height: 2.5rem;
  }
  .char-sheet .talk-row .btn-primary {
    padding: 0 1rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .char-sheet .talk-log {
    gap: 0.35rem;
  }
  .char-sheet .talk-line {
    font-size: 0.8rem;
    line-height: 1.5;
  }
  .char-sheet .talk-line.npc,
  .char-sheet .talk-line.user {
    padding: 0.4rem 0.65rem;
  }
  .char-sheet .talk-row {
    margin-top: 0.5rem;
  }
}

/* ---------- 六、人物面板整体按原型图（PC / 平板） ---------- */
@media (min-width: 901px) {
  /* 背景：庭院图淡洗成纸色 */
  .char-sheet.consort-panel .npc-bg-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(180deg, rgba(247, 243, 232, 0.90) 0%, rgba(244, 241, 232, 0.72) 38%, rgba(244, 241, 232, 0.86) 100%),
      radial-gradient(70% 55% at 50% 108%, rgba(244, 241, 232, 0.95), rgba(244, 241, 232, 0) 70%);
  }

  /* 姓名与身份签：原型图的顶部小字层级（上移，给立绘让出高度） */
  .char-sheet.consort-panel .npc-header {
    top: 0;
    left: 52px;
    gap: 6px;
  }

  .char-sheet.consort-panel .npc-title {
    font-size: clamp(26px, 2.6vw, 36px);
    letter-spacing: 0.06em;
    text-shadow: 0 1px 0 rgba(255, 253, 247, 0.85), 0 10px 24px rgba(255, 253, 247, 0.65);
  }

  .char-sheet.consort-panel .npc-subtitle {
    height: 28px;
    padding: 0 12px;
    font-size: 11.5px;
    letter-spacing: 0.14em;
    color: #5E5243;
    background: rgba(251, 248, 241, 0.82);
    border: 1px solid #D6CBBF;
    border-radius: 2px;
  }

  /* 左页：立绘装进纸框，上收留白让立绘更大，仍与上方文字留出间距 */
  .char-sheet.consort-panel .consort-portrait {
    padding: 122px 20px 22px 44px;
  }

  .char-sheet.consort-panel .consort-portrait .npc-frame-inner {
    padding: 0;
    background: #FBF8F1;
    border: 1px solid #C9BAAA;
    border-radius: 2px;
    box-shadow: 0 22px 46px -26px rgba(43, 36, 28, 0.7);
  }

  .char-sheet.consort-panel .consort-portrait .npc-frame-bg {
    top: 7px !important;
    left: 7px !important;
    right: 7px !important;
    bottom: 7px !important;
    width: calc(100% - 14px) !important;
    height: calc(100% - 14px) !important;
  }

  .char-sheet.consort-panel .consort-portrait .npc-frame-inner::after {
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(140, 122, 94, 0.32);
    border-radius: 0;
  }

  /* 右页：书页、左侧书脊、双层纸边 */
  .char-sheet.consort-panel .consort-right {
    padding: 26px 96px 26px 0;
  }

  .char-sheet.consort-panel .consort-right .npc-scroll-top,
  .char-sheet.consort-panel .consort-right .npc-scroll-bottom {
    display: none !important;
  }

  .char-sheet.consort-panel .consort-right .consort-info {
    margin-top: 0;
    padding: 22px 28px 26px;
    border-radius: 3px 7px 7px 3px;
    background:
      linear-gradient(90deg, rgba(203, 189, 170, 0.38) 0, rgba(251, 248, 241, 0) 16px),
      linear-gradient(180deg, #FCF9F2 0%, #F6F1E6 100%);
    box-shadow:
      0 22px 54px -26px rgba(43, 36, 28, 0.5),
      6px 6px 0 -1px #EFE8DA,
      12px 12px 0 -2px #E5DBC9;
  }

  /* 页签落在书页右侧留白里 */
  .char-sheet.consort-panel .npc-bookmarks {
    right: 16px;
    top: 58px;
    gap: 7px;
    max-height: calc(100% - 84px);
  }

  .char-sheet.consort-panel .npc-bookmarks .tab {
    width: 64px;
    height: 78px;
    font-size: 15px;
    letter-spacing: 0.1em;
    border: 1px solid rgba(214, 203, 191, 0.9);
    border-radius: 3px 3px 14px 14px;
    box-shadow: 0 4px 12px -6px rgba(43, 36, 28, 0.35);
  }

  .char-sheet.consort-panel .npc-bookmarks .tab.active {
    border-color: #6B5642;
    box-shadow: 0 10px 20px -12px rgba(43, 36, 28, 0.7);
  }
}
