:root {
  --gold: #d6b26e;
  --gold-soft: #ead4a4;
  --gold-dark: #a6803c;
  --navy: #1f334d;
  --navy-mid: #2c4668;
  --navy-light: #3d5d87;
  --cinnabar: #b53a32;
  --cinnabar-dark: #8c2620;
  --paper: #f7f3e8;
  --paper-card: #fcfaf4;
  --paper-border: #dfd4bc;
  --ink: #222b38;
  --ink-soft: #576273;
  --jade: #3c8067;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Songti SC", "STSong", "Microsoft YaHei", serif;
  background:
    linear-gradient(155deg, rgba(248, 242, 228, 0.78) 0%, rgba(235, 224, 198, 0.86) 55%, rgba(224, 212, 184, 0.9) 100%),
    url('assets/map_jiuzhou.jpg') center/cover no-repeat fixed;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  overscroll-behavior: none;
}

.phone-shell {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  max-height: 920px;
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(72, 54, 26, 0.24), 0 0 0 1.5px rgba(196, 158, 90, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
}

@media (max-width: 480px) {
  .phone-shell {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ================= 1. 顶部宋韵人物名片栏 ================= */
.header-card {
  background:
    radial-gradient(circle at 85% 0%, rgba(214, 178, 110, 0.16), transparent 55%),
    linear-gradient(180deg, #1d3049 0%, #263e5e 100%);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(18, 30, 48, 0.22);
  flex-shrink: 0;
  z-index: 5;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.avatar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.avatar-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5e2b5, #b68a3e, #f5e2b5);
  padding: 2.5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #d5e8f7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.identity-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: normal;
  flex-wrap: wrap;
}

.hero-name {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fffdf7;
}

.age-chip {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(214, 178, 110, 0.22);
  border: 1px solid rgba(214, 178, 110, 0.55);
  color: #f6e4b8;
  font-weight: 600;
}

.role-line {
  display: flex;
  align-items: center;
}

.role-chip {
  font-size: 11.5px;
  color: #cddbf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 165px;
}

.header-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.currency-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(14, 24, 38, 0.52);
  border: 1px solid rgba(214, 178, 110, 0.7);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  cursor: pointer;
}

.cur-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.cur-svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.province-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  color: #e4eefb;
  cursor: pointer;
}

.prov-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* 顶部横向快捷工具条 */
.quick-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.quick-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 4px;
  border-radius: 8px;
  border: 1px solid rgba(214, 178, 110, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #eef4fc;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.quick-btn:hover {
  background: rgba(214, 178, 110, 0.22);
}

.mini-badge {
  position: absolute;
  top: -5px;
  right: -3px;
  background: var(--cinnabar);
  color: #fff;
  font-style: normal;
  font-size: 9.5px;
  padding: 0 4px;
  border-radius: 999px;
  border: 1px solid #fff;
  line-height: 1.3;
}

/* ================= 2. 紧凑 3×2 六维属性矩阵 ================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #dce7f7;
}

.stat-head-left {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.stat-num {
  font-weight: 700;
  color: #fff;
  font-size: 11px;
}

.stat-track {
  height: 5px;
  background: rgba(10, 18, 30, 0.45);
  border-radius: 999px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ================= 3. 超宽敞宣纸书卷生平履历区 ================= */
.scroll-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(214, 178, 110, 0.1), transparent 45%),
    radial-gradient(circle at 88% 82%, rgba(61, 93, 135, 0.08), transparent 45%),
    var(--paper);
}

.life-guide {
  background: linear-gradient(135deg, rgba(220,232,222,.62), rgba(250,244,230,.95));
  border-left: 3px solid var(--gold-dark);
}
.life-guide-heading {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--navy-mid);
  letter-spacing: 1px;
}
.life-guide-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 700;
  color: #3a3125;
  overflow-wrap: anywhere;
}
.life-guide-note { margin: 8px 0 0; font-size: 13px; color: #75694f; }

.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 26px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  scrollbar-width: thin;
}

.log-year-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: clamp(16px, 4.2vw, 18px);
  line-height: 1.6;
  font-weight: 800;
  color: var(--navy-mid);
  letter-spacing: 0.5px;
}

.log-year-header::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-dark);
}

.log-year-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(166, 128, 60, 0.4), transparent);
}

.log-entry {
  margin-bottom: 5px;
  padding-left: 10px;
  border-left: 2px solid transparent;
}

.log-entry.good {
  color: #215e43;
  border-left-color: #3c8067;
  font-weight: 600;
}

.log-entry.important {
  color: #8f2620;
  border-left-color: var(--cinnabar);
  font-weight: 600;
}

/* ================= 4. 底部单手人体工学功能 Dock 栏 ================= */
.bottom-dock {
  position: relative;
  min-height: 70px;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #fcfaf4 0%, #efe7d5 100%);
  border-top: 1.5px solid var(--gold);
  box-shadow: 0 -4px 16px rgba(31, 51, 77, 0.1);
  display: grid;
  grid-template-columns: 1fr 1fr 88px 1fr 1fr;
  align-items: center;
  padding: 0 6px calc(4px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  z-index: 10;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  padding: 6px 2px;
  border-radius: 10px;
  font-family: inherit;
  transition: background 0.15s, transform 0.12s;
}

.dock-btn:hover {
  background: rgba(31, 51, 77, 0.06);
}

.dock-btn:active {
  transform: scale(0.94);
}

.dock-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-mid);
}

.dock-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.dock-alert {
  position: absolute;
  top: -2px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cinnabar);
  border: 1.5px solid #fff;
}

/* 居中突出朱砂鎏金「下一年」玉印大按钮 */
.dock-center-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.next-year-seal {
  position: absolute;
  top: -48px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--paper-card);
  background: linear-gradient(145deg, #c9463d, #92231c);
  box-shadow:
    0 0 0 2px var(--gold),
    0 8px 20px rgba(146, 35, 28, 0.42);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.next-year-seal:hover {
  filter: brightness(1.06);
}

.next-year-seal:active {
  transform: scale(0.93);
}

.seal-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 224, 175, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}

.seal-text {
  color: #fff9eb;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ================= 全屏二级场景页面 ================= */
.subpage-view {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 12%, rgba(214, 178, 110, 0.12), transparent 45%),
    var(--paper);
  display: flex;
  flex-direction: column;
  z-index: 40;
  animation: pageSlideIn 0.18s ease-out;
}

@keyframes pageSlideIn {
  from { transform: translateX(18px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

.subpage-header {
  background: linear-gradient(90deg, #1b2e47, #2c4669);
  color: #fff;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}

.subpage-header h2 {
  font-size: 16.5px;
  letter-spacing: 1.5px;
  font-weight: 800;
}

.subpage-back {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(214, 178, 110, 0.55);
  color: #f8e9c4;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.subpage-spacer {
  width: 56px;
}

.subpage-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 城中活动场所 2 列精致图标网格 */
.venue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.venue-card {
  background: var(--paper-card);
  border: 1.5px solid var(--paper-border);
  border-radius: 13px;
  padding: 13px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
  box-shadow: 0 2px 6px rgba(31, 51, 77, 0.06);
}

.venue-card:hover {
  border-color: var(--gold-dark);
  box-shadow: 0 5px 14px rgba(31, 51, 77, 0.12);
  transform: translateY(-2px);
}

.venue-card.is-locked {
  opacity: 0.65;
  background: #f0ece2;
}

.venue-icon-badge {
  width: 66px;
  height: 66px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--gold);
  background: #faf5e8;
  box-shadow: 0 2px 8px rgba(31, 51, 77, 0.14);
}

.venue-icon-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.venue-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--navy);
}

.venue-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* 互动小游戏：校场射靶动态靶盘 */
.archery-arena {
  background: linear-gradient(180deg, #eef4e8, #dfead6);
  border: 1.5px solid #9ab58a;
  border-radius: 12px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.target-bar-wrap {
  position: relative;
  width: 100%;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5a6c82 0%, #7ea0c4 22%, #e8c35a 40%, #c93d35 48%, #c93d35 52%, #e8c35a 60%, #7ea0c4 78%, #5a6c82 100%);
  border: 2px solid #2b3c54;
  overflow: hidden;
}

.target-cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 6px;
  background: #fff;
  border: 1.5px solid #111;
  border-radius: 3px;
  left: 50%;
  transform: translateX(-50%);
}

/* 草丛捉促织网格 */
.grass-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.grass-spot {
  height: 76px;
  border-radius: 12px;
  border: 1.5px solid #8eb37d;
  background: linear-gradient(145deg, #e5f1dc, #cde0be);
  font-size: 13px;
  font-weight: 700;
  color: #2f5429;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.grass-spot.rustling {
  border-color: #c9463d;
  background: linear-gradient(145deg, #f9f0d8, #ead9aa);
  animation: wiggle 0.55s infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2.5deg); }
  75% { transform: rotate(2.5deg); }
}

/* ================= 可视化古风九州大地图（宋韵青绿山水绢本舆图） ================= */
.world-map-board {
  position: relative;
  width: 100%;
  height: 328px;
  border-radius: 13px;
  border: 2px solid #9e7b3c;
  background:
    linear-gradient(180deg, rgba(246, 238, 218, 0.14), rgba(235, 224, 198, 0.22)),
    url('assets/map_jiuzhou.jpg') center / cover no-repeat;
  box-shadow: inset 0 0 28px rgba(68, 46, 18, 0.34), 0 4px 14px rgba(31, 51, 77, 0.16);
  overflow: hidden;
  flex-shrink: 0;
}

.world-map-seal {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  background: rgba(168, 46, 39, 0.9);
  color: #fdf6e3;
  border: 1px solid #f2d599;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 6px rgba(68, 20, 16, 0.3);
  pointer-events: none;
}

.world-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(253, 249, 238, 0.94);
  border: 1.5px solid #8a6930;
  border-radius: 8px;
  padding: 3px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 3px 9px rgba(24, 38, 58, 0.26);
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
  z-index: 3;
}

.map-pin:hover, .map-pin.selected {
  transform: translate(-50%, -50%) scale(1.08);
  border-color: var(--navy);
  background: #fffdf7;
  box-shadow: 0 4px 12px rgba(24, 38, 58, 0.35);
  z-index: 6;
}

.map-pin.is-current {
  border: 2px solid var(--cinnabar);
  background: #fff7f4;
  box-shadow: 0 0 0 3px rgba(181, 58, 50, 0.2), 0 3px 10px rgba(24, 38, 58, 0.28);
}

.map-pin-name {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
}

.map-pin-badges {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
}

.pin-dot-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
  font-style: normal;
  white-space: nowrap;
  line-height: 1.25;
}
.pin-dot-tag.me { background: var(--cinnabar); color: #fff; }
.pin-dot-tag.home { background: #3c8067; color: #fff; }
.pin-dot-tag.kin { background: #2c4668; color: #f6e4b8; }

.sib-bio-list {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #dfd2b5;
  font-size: 11.5px;
  color: #6b5f4a;
  line-height: 1.45;
}

/* 全员六维微型属性展示组件 */
.mini-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 8px;
  margin-top: 3px;
  padding: 5px 7px;
  background: #f5f0e2;
  border: 1px solid #e3d8be;
  border-radius: 7px;
}

.mini-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: #4c5666;
}

.mini-stat-item b {
  color: var(--navy);
  font-weight: 800;
}

/* ================= 纵向宗族族谱（移动端优先） ================= */
.tree-scroll-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 178, 110, 0.14), transparent 55%),
    #faf5e8;
  border: 1.5px solid var(--gold-dark);
  border-radius: 12px;
  padding: 14px 10px 18px;
  width: 100%;
  min-width: 0;
}

.tree-title-banner {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 1px;
  border-bottom: 1.5px solid var(--gold);
  padding-bottom: 8px;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.tree-section {
  min-width: 0;
  margin-top: 16px;
}

.tree-section-title {
  font-size: 13px;
  color: var(--navy);
  line-height: 1.5;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.tree-note,
.tree-child-details,
.tree-ancestors {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.tree-note { margin: 0 0 8px; }
.tree-ancestors { margin: 0; padding-left: 20px; }

.tree-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.tree-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 9px 6px;
  border-radius: 10px;
  background: var(--paper-card);
  border: 1.5px solid #d5c39c;
  box-shadow: 0 2px 6px rgba(31, 51, 77, 0.08);
  text-align: center;
}

.tree-node.is-hero {
  border: 2px solid var(--cinnabar);
  background: #fff9f2;
}

.tree-node.is-deceased {
  background: #eee8dc;
  border-style: dashed;
}

.tree-node.is-deceased img { filter: grayscale(100%); }

.tree-node img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  object-fit: cover;
  background: #d5e8f7;
}

.tree-node-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tree-node-sub {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tree-node-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
}

.tree-tag-mini {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #ebe2cc;
  color: #5c4724;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tree-tag-mini.heir {
  background: var(--cinnabar);
  color: #fff;
}

.tree-child-branch {
  min-width: 0;
  border: 1px solid #d5c39c;
  border-radius: 10px;
  padding: 8px;
  margin-top: 10px;
}

.tree-child-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
  align-items: center;
}

.tree-child-details { min-width: 0; }
.tree-child-details p { margin: 0 0 4px; }

.tree-descendants {
  border-left: 2px solid var(--gold-dark);
  margin: 12px 0 0 6px;
  padding-left: 10px;
  min-width: 0;
}

@media (min-width: 480px) {
  .tree-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ================= 弹窗与通用卡片 ================= */
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 24, 38, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 50;
}

.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-height: 86%;
  background: var(--paper);
  border: 1.5px solid var(--gold-dark);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(90deg, #1d3049, #2f4b70);
  color: #fff;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 16.5px;
  letter-spacing: 1px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #f6e7c1;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.panel-tabs {
  display: flex;
  background: #ebe3d2;
  border-bottom: 1px solid #d5c8ad;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  min-height: 40px;
}

.panel-tab {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  padding: 10px 10px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  color: #5b5140;
  cursor: pointer;
  white-space: nowrap;
}

.panel-tab.active {
  background: var(--paper);
  color: var(--navy);
  border-bottom: 2.5px solid var(--navy);
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card {
  background: var(--paper-card);
  border: 1px solid var(--paper-border);
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(31, 51, 77, 0.04);
}

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

.npc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #d5e8f7;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(31, 51, 77, 0.2);
}

.npc-avatar.deceased {
  filter: grayscale(100%) opacity(0.65);
}

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

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
}

.pill-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7eef7;
  color: #29456b;
  font-weight: 700;
  white-space: nowrap;
}

.pill-tag.warn { background: #fbe8e7; color: #b53a32; }
.pill-tag.gold { background: #f8efd8; color: #966a1d; }
.pill-tag.green { background: #e3f2eb; color: #246b49; }

.card-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #41516c;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.btn-primary, .btn-secondary, .btn-small, .btn-danger {
  border: none;
  border-radius: 7px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
}

.btn-primary {
  background: linear-gradient(180deg, #2d4970, #1d314d);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--gold);
}

.btn-secondary {
  background: #ebe2ce;
  color: #3a3326;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #cbb994;
}

.btn-small {
  background: #274269;
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
}

.btn-small.outline {
  background: #f5efe1;
  color: #2a4369;
  border: 1px solid #c9b99a;
}

.btn-small.danger {
  background: var(--cinnabar);
  color: #fff;
}

.btn-small:disabled, .btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice-btn.is-locked {
  opacity: 0.55;
}

.btn-small.is-locked {
  background: #a4aebd;
  color: #f4f6fa;
  border-color: #a4aebd;
  opacity: 0.85;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.qty-input {
  width: 54px;
  text-align: center;
  padding: 4px 4px;
  border: 1px solid #cbb994;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  background: #fff;
  color: var(--navy);
}

/* 购物分类筛选与古风图标 */
.cat-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.cat-chip {
  border: 1px solid #cbb994;
  background: #f5efe1;
  color: #4a3f2d;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cat-chip.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--gold);
}

.item-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 11px;
  border: 1.5px solid var(--gold);
  background: #faf5e8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(31, 51, 77, 0.14);
}

.item-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 地域特色宅院高清配图卡片 */
.house-hero-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.house-banner-img {
  width: 100%;
  height: 175px;
  object-fit: cover;
  border-radius: 10px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 3px 10px rgba(31, 51, 77, 0.14);
}

.cap-bar-track {
  height: 8px;
  background: #e5dcc8;
  border-radius: 999px;
  overflow: hidden;
}

.cap-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3c8067, #5aa88a);
  transition: width 0.3s;
}

.cap-bar-fill.full {
  background: linear-gradient(90deg, #c74b4b, #9c2b25);
}

/* 分类差异化剧情事件弹窗框体 */
.event-card {
  overflow-y: auto;
  overscroll-behavior: contain;
  max-width: 400px;
  border-width: 2px;
}

/* 1. 宅斗 / 私生子 / 背德：绛红暗金「内宅密卷」风 */
.event-card.theme-intrigue {
  border-color: #8f2620;
  box-shadow: 0 20px 50px rgba(90, 18, 15, 0.5), 0 0 0 2px rgba(214, 178, 110, 0.65);
}
.event-card.theme-intrigue .event-ribbon {
  background: linear-gradient(135deg, #6e1814, #9e2a23);
  border-bottom: 2px solid #e6c173;
}
.event-card.theme-intrigue .event-tag {
  background: #f5d896;
  color: #5c120e;
}

/* 2. 科考 / 仕途：青金御旨「金榜圣旨」风 */
.event-card.theme-career {
  border-color: #b88b32;
  box-shadow: 0 20px 50px rgba(25, 42, 72, 0.55), 0 0 0 2px rgba(235, 200, 115, 0.75);
}
.event-card.theme-career .event-ribbon {
  background: linear-gradient(135deg, #1b3154, #2f5182);
  border-bottom: 2.5px solid #ecc972;
}
.event-card.theme-career .event-tag {
  background: #ecc972;
  color: #1c2c47;
}

/* 3. 红颜 / 奇遇：绯粉海棠「风月花笺」风 */
.event-card.theme-romance {
  border-color: #b56576;
  box-shadow: 0 20px 50px rgba(105, 45, 62, 0.45), 0 0 0 2px rgba(242, 201, 210, 0.7);
}
.event-card.theme-romance .event-ribbon {
  background: linear-gradient(135deg, #8c3d52, #b85d75);
  border-bottom: 2px solid #f5d6de;
}
.event-card.theme-romance .event-tag {
  background: #fff0f4;
  color: #8c3d52;
}

/* 4. 家世 / 嫡庶：墨绿古铜「宗族族谱」风 */
.event-card.theme-clan {
  border-color: #355e4b;
  box-shadow: 0 20px 50px rgba(25, 52, 40, 0.48), 0 0 0 2px rgba(214, 178, 110, 0.65);
}
.event-card.theme-clan .event-ribbon {
  background: linear-gradient(135deg, #214536, #356651);
  border-bottom: 2px solid #d6b26e;
}
.event-card.theme-clan .event-tag {
  background: #e9d7a9;
  color: #1f3d30;
}

.event-ribbon {
  background: linear-gradient(90deg, #1d3049, #2f4b70);
  color: #fff;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--gold);
}

.event-tag {
  background: var(--cinnabar);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.event-ribbon h3 { font-size: 16.5px; letter-spacing: 0.5px; }

.event-content {
  padding: 16px;
  font-size: 14px;
  line-height: 1.75;
  color: #253042;
  background: var(--paper-card);
}

.event-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #7d6844;
}

.event-choices {
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f3ede0;
  border-top: 1px solid #e1d5bc;
}

.choice-btn {
  text-align: left;
  background: var(--paper-card);
  border: 1.5px solid #cbb994;
  border-radius: 9px;
  padding: 11px 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.choice-btn:hover {
  background: #edf3fa;
  border-color: var(--navy-light);
}

.choice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: block;
}

/* 投胎开局弹窗 */
.birth-card { max-height: 92%; }

.birth-header {
  background: linear-gradient(135deg, #1d3049, #2f4b70);
  color: #fff;
  text-align: center;
  padding: 18px 14px 14px;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}

.birth-seal {
  display: inline-block;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.birth-header h1 { font-size: 20px; letter-spacing: 2px; }
.birth-header p { font-size: 12px; color: #d6e4f7; margin-top: 4px; }

.birth-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 12.5px; font-weight: 700; color: #4b4336; }

.name-input-group { display: flex; gap: 6px; }
.name-input-group input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #cbb994;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: var(--paper-card);
}

.select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.select-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #cbb994;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: var(--paper-card);
  color: var(--ink);
}

.family-choice-list { display: flex; flex-direction: column; gap: 7px; }
.family-option {
  background: var(--paper-card);
  border: 1.5px solid #dcd0b8;
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
}

.family-option.selected {
  border-color: var(--navy);
  background: #edf3fa;
  box-shadow: 0 0 0 2px rgba(31, 51, 77, 0.14);
}

.birth-actions { display: flex; gap: 8px; }
.birth-actions button { flex: 1; }
.continue-wrap { text-align: center; }

.btn-link {
  background: none;
  border: none;
  color: var(--navy-mid);
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
}

/* 轻提示 */
.toast {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  background: rgba(24, 36, 54, 0.94);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--gold);
  z-index: 90;
  max-width: 88%;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* =====================================================================
   三幕国风画卷开场动画 + 家世抉择（明亮宋风青绿山水 × 暖金宣纸渐变）
   ===================================================================== */
.intro-mask {
  padding: 0;
  background: linear-gradient(180deg, #f8f2e3 0%, #ebe1c9 100%);
  z-index: 65;
}

.birth-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #223244;
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Kaiti SC", "SimSun", Georgia, serif;
  background: linear-gradient(165deg, #fbf7ec 0%, #eef3eb 48%, #f4e8cf 100%);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  transition: background 0.6s ease;
}

.birth-stage[data-theme="peasant"] {
  background: linear-gradient(165deg, #fcf8ec 0%, #f5edd6 52%, #eadbb8 100%);
}
.birth-stage[data-theme="merchant"] {
  background: linear-gradient(165deg, #f6fbf8 0%, #e4f0e8 52%, #f1e6cc 100%);
}
.birth-stage[data-theme="scholar"] {
  background: linear-gradient(165deg, #faf8f0 0%, #e8efe8 52%, #efe4cc 100%);
}
.birth-stage[data-theme="noble"] {
  background: linear-gradient(165deg, #fdf6ee 0%, #f5e6d2 52%, #ebd4b4 100%);
}

/* 底层宋风青绿山水插画：第一幕高清全幅呈现，二三幕柔化为画卷底纹 */
.intro-bg-scroll {
  position: absolute;
  inset: -4%;
  background: url('assets/intro_prologue.jpg') center top/cover no-repeat;
  opacity: 0.96;
  animation: introScrollDrift 24s ease-in-out infinite alternate;
  pointer-events: none;
  transition: opacity 0.6s ease, filter 0.6s ease;
}

.birth-stage[data-act="2"] .intro-bg-scroll,
.birth-stage[data-act="3"] .intro-bg-scroll {
  opacity: 0.24;
  filter: saturate(0.95) brightness(1.06);
}

@keyframes introScrollDrift {
  0% { transform: scale(1.02) translate3d(0, 0, 0); }
  100% { transform: scale(1.1) translate3d(-1.2%, -1.5%, 0); }
}

/* 丝滑多段暖宣纸渐变遮罩：全幅通透展现青绿山水、阁楼与石桥，仅在最底部轻柔托底 */
.intro-bg-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(250, 244, 230, 0.22) 0%,
    rgba(250, 244, 230, 0.0) 16%,
    rgba(250, 244, 230, 0.0) 64%,
    rgba(248, 240, 222, 0.72) 86%,
    rgba(243, 231, 205, 0.94) 100%
  );
  pointer-events: none;
  transition: background 0.55s ease;
}

.birth-stage[data-act="2"] .intro-bg-vignette,
.birth-stage[data-act="3"] .intro-bg-vignette {
  background: linear-gradient(
    180deg,
    rgba(252, 248, 238, 0.72) 0%,
    rgba(246, 242, 230, 0.62) 48%,
    rgba(243, 233, 211, 0.86) 100%
  );
}

/* 飘落桂花与暖金光尘 */
.intro-motes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.intro-motes span {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 7px;
  border-radius: 60% 40% 60% 40%;
  background: radial-gradient(circle, #f3c868, rgba(236, 178, 84, 0.25));
  opacity: 0;
  animation: petalDrift 11s linear infinite;
}

.intro-motes span:nth-child(1) { left: 14%; animation-delay: 0s; animation-duration: 9.5s; }
.intro-motes span:nth-child(2) { left: 31%; animation-delay: 2.1s; animation-duration: 11.5s; width: 6px; height: 6px; background: radial-gradient(circle, #f5b6a8, rgba(245, 182, 168, 0.2)); }
.intro-motes span:nth-child(3) { left: 52%; animation-delay: 3.6s; animation-duration: 10.2s; }
.intro-motes span:nth-child(4) { left: 68%; animation-delay: 1.1s; animation-duration: 12s; width: 8px; height: 6px; background: radial-gradient(circle, #f5c3b5, rgba(245, 195, 181, 0.2)); }
.intro-motes span:nth-child(5) { left: 82%; animation-delay: 2.8s; animation-duration: 9.8s; }
.intro-motes span:nth-child(6) { left: 93%; animation-delay: 4.5s; animation-duration: 10.8s; width: 6px; height: 6px; }

@keyframes petalDrift {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.85; }
  80% { opacity: 0.6; }
  100% { transform: translateY(96vh) translateX(-34px) rotate(220deg); opacity: 0; }
}

.intro-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  flex-shrink: 0;
}

.intro-steps {
  display: flex;
  gap: 6px;
  font-size: 11.5px;
  color: rgba(45, 62, 79, 0.65);
  background: rgba(255, 252, 245, 0.72);
  backdrop-filter: blur(6px);
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(188, 152, 86, 0.36);
}

.intro-step {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.intro-step.active {
  color: #8b251e;
  border-color: rgba(178, 53, 44, 0.35);
  background: linear-gradient(135deg, #fff6e3, #f6e1b5);
  font-weight: 700;
}

.intro-step.done {
  color: #3c6556;
  font-weight: 600;
}

.intro-skip-btn {
  background: rgba(255, 252, 245, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(178, 140, 74, 0.48);
  color: #4d3b20;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(85, 63, 27, 0.12);
}

.intro-act {
  position: relative;
  z-index: 3;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 10px;
  animation: actFadeIn 0.45s ease both;
}

.intro-act.hidden { display: none; }

@keyframes actFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 第一幕：宋画题跋式竖排构图（右题大字朱印、左落三行小楷，留白映衬山水亭台） */
.prologue-colophon {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 18px 0 22px;
}

.colophon-title-group {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 12px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(252, 248, 238, 0.72) 0%, rgba(252, 248, 238, 0.34) 100%);
  backdrop-filter: blur(2px);
  box-shadow: 0 6px 22px rgba(92, 72, 38, 0.08);
  animation: inkReveal 0.9s 0.1s ease both;
}

.prologue-title-vert {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 10px;
  font-weight: 700;
  color: #1c2f42;
  text-shadow: 0 2px 10px rgba(255, 250, 238, 0.9);
  margin: 0;
}

.colophon-sub-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
}

.prologue-sub-vert {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 14px;
  letter-spacing: 5px;
  color: #7c5922;
  font-weight: 600;
}

.prologue-chop {
  writing-mode: vertical-rl;
  text-orientation: upright;
  width: 24px;
  padding: 4px 0;
  border: 1.5px solid #a82b24;
  background: rgba(168, 43, 36, 0.9);
  color: #fdf5e4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 3px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(168, 43, 36, 0.25);
}

.colophon-poem-group {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 14px;
  margin-top: auto;
  margin-bottom: 22px;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(252, 247, 236, 0.78) 0%, rgba(248, 239, 220, 0.56) 100%);
  backdrop-filter: blur(2px);
}

.ink-vert {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 15.5px;
  letter-spacing: 5px;
  line-height: 1.5;
  color: #2b3c4d;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-10px);
  filter: blur(3px);
  animation: inkReveal 0.95s var(--d, 0.35s) ease forwards;
}

.ink-vert.accent {
  color: #962921;
  font-weight: 700;
  padding-top: 16px;
}

.prologue-bottom-cta {
  padding: 6px 0 18px;
  text-align: center;
  flex-shrink: 0;
}

@keyframes inkReveal {
  0% { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.intro-seal-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 10px 13px;
  border-radius: 999px;
  border: 1.2px solid #e6c173;
  background: linear-gradient(135deg, #b5382e 0%, #8a2018 100%);
  color: #fffaf0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2.5px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 22px rgba(138, 32, 24, 0.3), inset 0 1px 0 rgba(255, 234, 190, 0.45);
  opacity: 0;
  animation: sealBtnAppear 0.7s 2.1s ease forwards;
}

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

.seal-btn-stamp {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #f7dc9c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff2cc;
  background: rgba(255, 215, 130, 0.16);
}

@keyframes sealBtnAppear {
  0% { opacity: 0; transform: scale(0.92) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 第二幕：画卷择门（明亮暖金宣纸 + 清晰建筑插画） */
.act-header {
  text-align: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.act-header.compact { margin-bottom: 8px; }

.act-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #9e6e24;
  margin-bottom: 2px;
}

.act-header h2 {
  font-size: 21px;
  letter-spacing: 2px;
  color: #1c3148;
}

.act-motto {
  margin-top: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: #7c382b;
  min-height: 20px;
  line-height: 1.5;
  transition: opacity 0.25s ease;
}

.intro-family-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 11px;
  padding: 6px 2px 10px;
}

.family-scene-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(196, 162, 100, 0.62);
  background: linear-gradient(135deg, #fffdf8 0%, #f8f0df 100%);
  cursor: pointer;
  flex: 0 0 auto;
  min-height: 102px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(90, 68, 34, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  transition: transform 0.22s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  animation: cardSlideIn 0.48s var(--stagger, 0s) ease forwards;
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 清晰展示右侧手绘国风古宅插画，柔光宣纸渐变自然衔接左侧文字 */
.family-scene-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56%;
  background-size: cover;
  background-position: center;
  opacity: 0.92;
  transition: transform 0.45s ease, opacity 0.3s ease;
  pointer-events: none;
}

.family-scene-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 253, 248, 0.98) 0%,
    rgba(252, 246, 233, 0.92) 48%,
    rgba(250, 243, 226, 0.45) 74%,
    rgba(250, 243, 226, 0.08) 100%
  );
  pointer-events: none;
}

.family-scene-content {
  position: relative;
  z-index: 2;
  max-width: 74%;
}

.family-scene-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.family-scene-name {
  font-size: 16px;
  font-weight: 800;
  color: #1c3148;
  letter-spacing: 1px;
}

.family-scene-money {
  font-size: 11px;
  font-weight: 700;
  color: #825a17;
  background: linear-gradient(135deg, #fff5dc, #f4dfae);
  border: 1px solid rgba(196, 152, 70, 0.55);
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.family-scene-poem {
  line-height: 1.5;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #8c4829;
}

.family-scene-desc {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #4a5562;
}

.family-scene-stamp {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 3;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #be352b, #96221a);
  border: 1.5px solid #fae0a8;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(150, 34, 26, 0.35);
  opacity: 0;
  transform: scale(1.35) rotate(-8deg);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.family-scene-card.selected {
  border-color: #b83b31;
  box-shadow: 0 0 0 2px rgba(184, 59, 49, 0.22), 0 8px 20px rgba(120, 74, 34, 0.18);
  transform: translateY(-1px);
}

.family-scene-card.selected .family-scene-bg {
  opacity: 1;
  transform: scale(1.06);
}

.family-scene-card.selected .family-scene-stamp {
  opacity: 1;
  transform: scale(1) rotate(-6deg);
}

.family-scene-card.roulette-flash {
  border-color: #d49b2a;
  box-shadow: 0 0 18px rgba(212, 155, 42, 0.55);
}

.intro-act-footer {
  display: flex;
  gap: 10px;
  padding: 10px 0 4px;
  flex-shrink: 0;
}

.intro-act-footer button {
  flex: 1;
  border-radius: 999px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.intro-act-footer .btn-secondary,
.intro-form-body .btn-secondary {
  background: linear-gradient(135deg, rgba(255, 252, 245, 0.94), rgba(242, 230, 204, 0.94));
  color: #5c421d;
  border: 1.2px solid rgba(186, 146, 76, 0.65);
  box-shadow: 0 3px 10px rgba(90, 68, 34, 0.1);
}

.intro-act-footer .btn-primary,
.intro-form-body .btn-primary {
  background: linear-gradient(135deg, #b83b31 0%, #8f231b 100%);
  color: #fffaf0;
  border: 1.2px solid #e6c173;
  box-shadow: 0 6px 16px rgba(146, 36, 28, 0.28);
}

/* 第三幕：立轴宣纸命簿（告别古早网页方框，采用中式底线笔意输入框 + 卷轴边框） */
.intro-form-body {
  position: relative;
  background:
    radial-gradient(circle at 100% 0%, rgba(214, 178, 110, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.96) 0%, rgba(248, 240, 223, 0.97) 100%);
  color: var(--ink);
  border-radius: 16px;
  border: 1.5px solid rgba(196, 158, 90, 0.72);
  box-shadow:
    0 12px 30px rgba(84, 62, 30, 0.16),
    inset 0 0 0 5px rgba(255, 251, 240, 0.65),
    inset 0 0 0 6px rgba(196, 158, 90, 0.28);
  padding: 18px 18px 20px;
  gap: 15px;
  flex: 0 1 auto;
  margin: auto 0;
}

.scroll-ornament-top {
  text-align: center;
  position: relative;
  margin-bottom: -2px;
}

.scroll-ornament-top::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(188, 150, 82, 0.55), transparent);
}

.scroll-ornament-top span {
  position: relative;
  background: #fdf9ef;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #9b6c26;
}

.intro-form-body .form-row { gap: 6px; }
.intro-form-body .form-row label {
  font-size: 12px;
  letter-spacing: 1px;
  color: #7b5d33;
}

.intro-form-body .name-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.intro-form-body .name-input-group input {
  min-width: 0;
  border: none;
  border-bottom: 1.5px solid rgba(164, 128, 68, 0.52);
  border-radius: 6px 6px 0 0;
  background: rgba(255, 252, 244, 0.72);
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  color: #1c3148;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.intro-form-body .name-input-group input:focus {
  outline: none;
  border-bottom-color: #b5352b;
  background: #fffdf8;
}

.intro-form-body .name-input-group button {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, #27415e, #1a2d44);
  color: #f8e4b6;
  border: 1px solid rgba(212, 168, 86, 0.55);
}

.intro-form-body .select-input {
  border: none;
  border-bottom: 1.5px solid rgba(164, 128, 68, 0.48);
  border-radius: 6px 6px 0 0;
  background: rgba(255, 252, 244, 0.72);
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #23364a;
}

.intro-form-body .select-input:focus {
  outline: none;
  border-bottom-color: #b5352b;
}

.intro-form-body .birth-actions {
  gap: 10px;
  margin-top: 4px;
}

.intro-form-body .birth-actions button {
  border-radius: 999px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

.chosen-family-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5e8cc 0%, #fcf6e8 100%);
  border: 1px solid rgba(196, 158, 90, 0.62);
}

.chosen-family-thumb {
  width: 48px;
  height: 48px;
  border-radius: 9px;
  object-fit: cover;
  border: 1.5px solid #d4a856;
  flex-shrink: 0;
}

.chosen-family-banner button {
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 5px 11px;
}

.chosen-family-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.chosen-family-label {
  font-size: 10.5px;
  color: #8a6c3e;
  letter-spacing: 1px;
}

.chosen-family-info strong {
  font-size: 15.5px;
  color: var(--navy);
}

.intro-continue {
  position: relative;
  z-index: 4;
  padding: 6px 14px 12px;
  flex-shrink: 0;
}

.intro-continue-btn {
  background: rgba(255, 252, 245, 0.86);
  border: 1px solid rgba(180, 140, 72, 0.55);
  color: #5b411c;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(85, 63, 27, 0.1);
}

/* 落印降生过场遮罩 */
.birth-stamp-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: radial-gradient(circle, rgba(255, 250, 238, 0.96) 0%, rgba(235, 224, 198, 0.96) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: stampOverlayIn 0.35s ease both;
}

.birth-stamp-overlay.hidden { display: none; }

.birth-stamp-seal {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  border: 4px solid #a82b24;
  background: linear-gradient(135deg, #c23a2f, #94221a);
  color: #fdf5e3;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 4px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(168, 43, 36, 0.35);
  animation: stampSlam 0.48s cubic-bezier(0.22, 1.35, 0.36, 1) both;
}

.birth-stamp-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #24344d;
}

@keyframes stampOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes stampSlam {
  0% { opacity: 0; transform: scale(2.1) rotate(-14deg); }
  70% { opacity: 1; transform: scale(0.92) rotate(-4deg); }
  100% { opacity: 1; transform: scale(1) rotate(-6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .intro-bg-scroll, .intro-motes span, .ink-line, .intro-seal-btn, .family-scene-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

#child-name-modal { z-index: 55; }
#child-name-input { width: 100%; margin-top: 10px; font-size: 16px; }
#child-name-error { color: var(--cinnabar); min-height: 1.5em; overflow-wrap: anywhere; }

/* 长剧情与多名继嗣必须可滚到末项，不能被通用卡片裁掉。 */
.event-card > .event-ribbon,
.event-card > .event-content,
.event-card > .event-choices { flex-shrink: 0; }


/* 子嗣列表留白，个人详情沿纵向展开操作。 */
.child-summary { width:100%; text-align:left; font-family:inherit; cursor:pointer; flex-shrink:0; }
.child-summary:hover, .child-summary:focus-visible { border-color:var(--gold-dark); background:#f9f3e6; }
.child-summary .npc-row { align-items:center; }
.child-summary .card-top { align-items:flex-start; }
.child-summary .card-title { overflow-wrap:anywhere; }
.child-summary-tags { display:flex; flex-wrap:wrap; gap:3px 9px; font-size:12px; color:var(--ink-soft); }
.child-summary-arrow { color:var(--gold-dark); font-size:25px; line-height:1; }
.child-detail-page > .info-card { flex-shrink:0; }
.child-action-section { gap:9px; }
.child-action-section > .card-title { margin-bottom:2px; }
.child-action.btn-small { background:var(--paper-card); color:var(--navy); border-color:#cbb994; display:grid; grid-template-columns:60px minmax(0,1fr); gap:12px; align-items:center; width:100%; padding:9px; text-align:left; font-family:inherit; white-space:normal; }
.child-action-art { width:60px; height:60px; object-fit:cover; border:1px solid var(--paper-border); border-radius:9px; background:#faf4e6; }
.child-action-copy { display:flex; flex-direction:column; gap:4px; min-width:0; }
.child-action-copy strong { font-size:14px; line-height:1.5; overflow-wrap:anywhere; }
.child-action-copy small { font-size:12px; font-weight:400; line-height:1.55; color:var(--ink-soft); overflow-wrap:anywhere; }
.child-action.is-locked { background:#e9e5dc; color:#756d60; border-color:#d6cfbf; opacity:1; }
.child-action.is-locked .child-action-copy small { color:inherit; }
.child-action:focus-visible { outline:2px solid var(--jade); outline-offset:2px; }
.child-grandchild-row + .child-grandchild-row { margin-top:14px !important; }
.subpage-header h2 { min-width:0; flex:1; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.subpage-back, .subpage-spacer { flex-shrink:0; }

.capital-exam-trip { flex-basis:100%; display:flex; flex-direction:column; align-items:flex-start; gap:8px; }


/* 外宅使用独立长页，操作纵排，避免挤入住宅清单。 */
.info-card[data-open-external-house] { cursor: pointer; }
.info-card[data-open-external-house]:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 3px; }
.external-house-detail .card-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.external-house-detail .card-actions .btn-small { min-height: 44px; white-space: normal; }


/* 妻妾沿用子女的摘要卡与图文操作，名分处置收于详情页。 */
.spouse-summary { padding:15px 14px; border-left:3px solid rgba(159,125,64,.5); }
.spouse-summary .npc-avatar { width:64px; height:64px; flex-shrink:0; }
.spouse-summary .npc-main,.spouse-matchmaker .npc-main { display:flex; flex-direction:column; gap:7px; min-width:0; }
.spouse-summary .card-title small { font-size:12px; font-weight:400; color:var(--ink-soft); }
.spouse-summary-notes { font-size:12px; line-height:1.5; color:#79694c; overflow-wrap:anywhere; }
.spouse-summary .pill-tag { white-space:nowrap; }
.spouse-matchmaker { border-style:dashed; background:rgba(240,232,212,.5); }
.spouse-matchmaker .npc-avatar { width:52px; height:52px; border-radius:10px; border-color:var(--paper-border); }
.spouse-detail-page>.info-card { flex-shrink:0; }
.spouse-profile .npc-row { align-items:flex-start; }
.spouse-profile .npc-avatar { width:78px; height:78px; flex-shrink:0; }
.spouse-profile .card-title { overflow-wrap:anywhere; }
.spouse-action.danger:not(.is-locked) { color:#8b382e; border-color:#c7977d; background:#fff8f0; }
.spouse-action-section:last-child { margin-bottom:12px; }
@media(max-width:360px) {
  .spouse-summary .npc-row { gap:10px; }
  .spouse-summary .npc-avatar { width:54px; height:54px; }
  .spouse-summary .card-top { flex-wrap:wrap; gap:5px; }
  .spouse-profile .npc-avatar { width:64px; height:64px; }
}

/* 书院与武学：手绘庭院和可进入的课业地点。 */
.learning-hero{position:relative;overflow:hidden;border:1px solid #c4ae7e;border-radius:18px;margin-bottom:14px;background:#faf4e6;min-height:155px}
.learning-hero>img{display:block;width:100%;height:205px;object-fit:cover}
.learning-hero>div{position:absolute;inset:auto 0 0;padding:30px 20px 14px;background:linear-gradient(transparent,rgba(250,244,230,.96));color:#294d47}
.learning-hero h2{font-size:26px;margin:4px 0 0;letter-spacing:.12em}.learning-hero span{font-size:13px;font-weight:700}
.learning-tabs{display:flex;gap:10px;margin:12px 0 18px}.learning-rooms{display:grid;gap:12px;margin:12px 0 24px}.learning-rooms .child-action{margin:0;width:100%}
.learning-peers>h3{font-size:20px;color:#445e4b;border-bottom:1px solid #d4c49d;padding:10px 0}.learning-peers .npc-main{min-width:0}
@media(min-width:700px){.learning-rooms{grid-template-columns:repeat(3,minmax(0,1fr))}.learning-rooms .child-action{align-items:flex-start}.learning-hero>img{height:260px}}

.assessment-choices{display:grid;gap:12px;margin-top:16px}.assessment-choices .choice-btn{text-align:left;white-space:normal;line-height:1.7;padding:16px}

.learning-rooms .child-action,[data-network-action]{display:flex;flex-direction:row;align-items:center;gap:14px;text-align:left;width:100%;padding:14px}
[data-network-action]{margin:0 0 12px}.learning-rooms .child-action-copy,[data-network-action] .child-action-copy{display:grid;gap:6px;flex:1;min-width:0;text-align:left}
.learning-rooms .child-action-art,[data-network-action] .child-action-art{flex:0 0 64px;width:64px;height:64px;object-fit:contain}
.case-paper-cover{display:flex;align-items:center;gap:12px;margin-bottom:8px}.case-paper-cover img{width:58px;height:58px;object-fit:contain;flex:none}

.learning-hero.is-civil>img{object-position:left center}.learning-hero.is-military>img{object-position:right center}
