/* ============================================
   横屏专用：背景图容器，留言板和氏系图按钮作为子元素
   ============================================ */
/* 默认隐藏横屏专用容器 */
.landscape-bg-container {
  display: none;
}

@media (orientation: landscape) {
  /* 隐藏原来的背景图 */
  .scene-bg-wrap > .scene-bg {
    display: none;
  }
  /* 横屏牌位文字字间距 - 使用text-indent补偿letter-spacing导致的偏移 */
  .tablet-text-main span {
    letter-spacing: 0.35em !important;
    text-indent: 0.35em !important;
  }

  /* 显示横屏专用容器 */
  .landscape-bg-container {
    display: block;
    position: relative;
    width: fit-content;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0 auto;
    overflow: visible;
  }
  /* 确保 .scene-bg-wrap 宽度仅由内容决定 */
  .scene-bg-wrap {
    width: auto !important;
    margin: 0 auto !important;
  }
  /* 留言板不超出容器左边界 */
  .scene-bg-wrap > .mobile-controls--landscape > .messages-clip {
    left: 0 !important;
    max-width: 20vw !important;
  }
  .landscape-bg-img {
    display: block;
    height: 100vh;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 210, 90, 0.75)) drop-shadow(0 0 24px rgba(255, 196, 46, 0.45)) !important;
    outline: 1px solid rgba(255, 213, 102, 0.85);
    outline-offset: 0;
  }
  /* 横版山海图入口：背景图组内顶部居中，略微缩小 */
  .landscape-bg-container > .genealogy-entry--landscape {
    position: absolute;
    top: 2.2%;
    left: 50%;
    transform: translateX(-50%);
    display: block;
  }
  .landscape-bg-container > .genealogy-entry--landscape img {
    width: clamp(86px, 12vw, 140px);
    height: auto;
  }

  /* 留言板 - 在 scene-bg-wrap 内 */
  .scene-bg-wrap > .mobile-controls--landscape {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }
  .scene-bg-wrap > .mobile-controls--landscape > .messages-clip {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: auto;
  }
}

/* ============================================
   全尺寸自适应 - 背景图按宽度缩放，固定上边距
   ============================================ */

/* 字体引用已移除，使用默认字体 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, .genealogy-entry, .incense-group {
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  outline: none;
}

:root {
  --primary-color: #d4af37;
  --bg-dark: #2f2513;
  --bg-medium: #796730;
  --bg-light: #a38d4b;
  --text-gold: #ffd700;
  --scene-top: 120px;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background-color: #21170c;
  background-image:
    linear-gradient(180deg, #6b4e1f 0%, #4d3516 36%, #31210f 68%, #1b130b 100%),
    repeating-linear-gradient(12deg, rgba(173, 131, 62, 0.05) 0 2px, rgba(34, 24, 13, 0.12) 2px 6px, rgba(98, 70, 31, 0.06) 6px 10px);
  background-blend-mode: normal, multiply;
  overflow-x: hidden;
  overflow-y: auto;
  /* 配合 viewport user-scalable=no，减少双击缩放等手势 */
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

/* 页面包裹：固定上边距，画布居中；氏系图入口独立于背景容器 */
.page-wrap {
  position: relative;
  min-height: 100vh;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

/* 竖屏：氏系图按钮 + 整页锁高防滚动条 */
@media (orientation: portrait) {
  html, body {
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
  }
  .genealogy-entry--landscape {
    display: none !important;
  }
  .genealogy-entry--portrait {
    display: block;
    position: fixed;
    top: calc((var(--scene-top) + env(safe-area-inset-top, 0px)) / 2);
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: fit-content;
    z-index: 10001;
  }
  .genealogy-entry--portrait img {
    width: clamp(3.4rem, 8vw, 4.24rem);
    height: clamp(3.4rem, 8vw, 4.24rem);
  }
  .tablet-inner {
    width: 42% !important;
    left: 29% !important;
    top: 2% !important;
    transform: none !important;
  }
}

/* 横屏：按高度适配、居中（默认走 100vh 逻辑，中间尺寸再单独覆盖） */
@media (orientation: landscape) {
  html, body {
    overflow: hidden;
  }
  .page-wrap {
    height: 100vh;
    overflow: hidden;
  }
  .scene-container {
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }
  /* scene-bg-wrap 作为定位上下文 */
  .scene-bg-wrap {
    position: relative !important;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100vw;
    margin: 0 auto;
    overflow: visible;
  }
  /* 留言板相对背景图定位 */
  .scene-bg-wrap > .mobile-controls--landscape {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  .scene-bg-wrap > .mobile-controls--landscape > .messages-clip {
    position: absolute !important;
    --drawer-width: min(20%, 280px);
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: var(--drawer-width) !important;
    height: 50% !important;
    max-height: 420px !important;
  }
  /* 氏系图按钮相对背景图定位 */
  .scene-bg-wrap > .genealogy-entry--landscape {
    position: absolute !important;
    top: 2.2% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  /* 背景图在所有横屏下按宽度等比例缩放（中间尺寸在下面再细化） */
  .scene-bg {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    flex-shrink: 0;
  }
  /* 图片相对定位层：始终与背景图容器同尺寸（适配任意背景比例） */
  .scene-img-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }
  /* 竖屏宽屏留言板在横屏下隐藏 */
  .message-board-portrait-wide {
    display: none !important;
  }
  .scene-content {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  /* 牌位相对背景图片居中 */
  .tablet-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  .tablet-frame .tablet-inner {
    pointer-events: auto;
    width: 490px !important;  /* 横屏时牌位固定尺寸 */
    max-width: none !important;
    left: 50% !important;
    top: 48% !important;  /* 向下移动 */
    transform: translate(-50%, -50%) !important;  /* 居中定位 */
  }
  /* 横屏隐藏竖屏香炉组和按钮 */
  .scene-footer {
    display: none !important;
  }
  .incense-group {
    display: none !important;
  }
  /* 横屏祭祖按钮样式 */
  .worship-btn-row--landscape {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    /* 与竖屏一致：行容器不拦截，只按钮可点，大 gap 不挡香炉 */
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .worship-btn-row--landscape .action-btn {
    pointer-events: auto;
    position: relative;
    z-index: 1;
  }
  /* 横屏操作按钮统一样式 */
  .action-btn {
    padding: 8px 18px;
    font-size: 14px;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.7);
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    white-space: nowrap;
  }
  .action-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--text-gold);
    border-color: var(--text-gold);
  }
  .action-btn.active {
    background: rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 10px rgba(255, 150, 50, 0.4);
  }
  /* 隐藏原来的上香按钮样式 */
  .worship-btn--landscape {
    display: none;
  }
  /* 香炉出现时，按钮分两侧显示 */
  .worship-btn-row--landscape.has-incense {
    gap: 380px;
  }
  .worship-btn-row--landscape.has-incense .action-btn--worship {
    display: none;
  }
  /* 横屏香炉组样式（与 .incense-group 同尺寸） */
  .incense-group--landscape {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    height: 280px;
    min-width: 380px;
    min-height: 280px;
    max-width: 380px;
    max-height: 280px;
    z-index: 10001;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
  }
  .incense-wrapper--landscape {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
  }
  .incense-burner--landscape {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-image: url(../images/ding.webp);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
  }
  .incense-burner--landscape.show-incense-burner {
    opacity: 1;
    visibility: visible;
  }
  .incense-burner--landscape .countdown {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    color: var(--primary-color);
    font-size: min(2.5vw, 14px);
    font-weight: bold;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 20;
    display: none;
    border: 2px solid rgba(212, 175, 55, 0.5);
    white-space: nowrap;
  }
  .incense-burner--landscape .incense-hint {
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    padding: 4px 12px;
    font-size: min(2.5vw, 12px);
    color: var(--text-gold);
    border-radius: 999px;
    letter-spacing: 1px;
    display: none;
    white-space: nowrap;
    animation: incenseHintBounce 3s ease-in-out infinite;
  }

}

/* ============================================
   中间尺寸布局：横屏但宽高比较小时
   ============================================ */
@media (orientation: landscape) and (max-aspect-ratio: 4/3) {
  html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  .page-wrap {
    display: flex;
    flex-direction: column;
    padding-top: 110px;
    position: relative;
  }
  .scene-container {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: auto;
  }
  /* 隐藏横屏专用容器 */
  .landscape-bg-container {
    display: none !important;
  }
  /* 显示原来的背景图 */
  .scene-bg-wrap > .scene-bg {
    display: block !important;
  }
  .scene-bg-wrap {
    position: relative;
    width: 100%;
    max-width: 100vw;
    flex-shrink: 0;
    height: auto;
    margin: 0 !important;
    overflow: visible;
  }
  /* 背景图按屏幕宽度等比例缩放（覆盖横屏大尺寸里的 height: 100vh 规则） */
  .scene-bg {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  /* 牌位层：相对于背景图定位 */
  .scene-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  .scene-content > * {
    pointer-events: auto;
  }
  /* 牌位与背景图等比例缩放 - 使用百分比 */
  .tablet-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  .tablet-frame .tablet-inner {
    pointer-events: auto;
    width: 35% !important;
    max-width: none !important;
    left: 32.5% !important;
    top: 1% !important;
    transform: none !important;
  }
  /* 中间尺寸文字容器调整 */
  .tablet-text-wrap {
    width: 70% !important;
    height: 95% !important;
    left: 15% !important;
    top: 0% !important;
  }
  /* 字体大小使用基础样式的 cqw 单位，绑定到牌位 */
  .tablet-text-main span {
    line-height: 1.2 !important;
    letter-spacing: 0.35em !important;
    text-indent: 0.35em !important;
    margin-top: 1% !important;
  }
  .tablet-text-sub {
    margin-top: 0% !important;
  }
  .tablet-text-sub span {
    line-height: 1.2 !important;
    letter-spacing: 0.1em !important;
  }
  .tablet-kaobi {
    letter-spacing: -0.25em !important;
    transform: translateX(-0.125em) !important;
  }
  /* 氏系图按钮在上方区域居中 */
  .genealogy-entry--landscape {
    display: none !important;
  }
  .genealogy-entry--portrait {
    display: block !important;
    position: absolute;
    top: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: fit-content;
    z-index: 10001;
  }
  .genealogy-entry--portrait img {
    width: 5.3rem;
    height: 5.3rem;
  }
  /* 香炉组隐藏（横屏小尺寸不需要） */
  .scene-footer {
    display: none !important;
  }
  .incense-group {
    display: none !important;
  }
  .worship-btn-row--landscape {
    display: flex !important;
  }
  .incense-group--landscape {
    display: flex !important;
  }
  /* 留言板用横屏样式，相对于背景图容器定位 */
  .mobile-controls--landscape {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    z-index: 5200;
  }
  .mobile-controls--landscape > * {
    pointer-events: auto;
  }
  .mobile-controls--portrait {
    display: none !important;
  }
  /* 中间尺寸留言板内容自适应缩小 */
  .mobile-controls--landscape .messages-clip {
    --drawer-width: min(22%, 180px);
    height: 35vh;
    max-height: 250px;
  }
  .mobile-controls--landscape .messages-header-row {
    padding: 4px 6px;
  }
  .mobile-controls--landscape .messages-title {
    font-size: 10px;
  }
  .mobile-controls--landscape .messages-drawer-toggle,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }
  .mobile-controls--landscape .messages-drawer-toggle .messages-btn-icon--hide,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn .messages-btn-icon--manager {
    width: 12px;
    height: 12px;
  }
  .mobile-controls--landscape .messages-container {
    padding: 5px;
  }
  .mobile-controls--landscape .message-item {
    padding: 4px;
    margin-bottom: 4px;
    min-height: 28px;
  }
  .mobile-controls--landscape .message-user {
    font-size: 10px;
    margin-bottom: 0;
    width: 50px;
  }
  .mobile-controls--landscape .message-content {
    font-size: 10px;
    margin-bottom: 0;
    line-height: 1.2;
  }
  .mobile-controls--landscape .message-time {
    font-size: 8px;
  }
  /* 中间尺寸按钮样式调整 */
  .worship-btn-row--landscape {
    bottom: 10px;
    gap: 8px;
  }
  .action-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
  }
  /* 中间尺寸香炉出现时按钮布局 */
  .worship-btn-row--landscape.has-incense {
    gap: 600px;
  }
}

/* 场景容器：宽度 100%，高度由背景图自身比例决定（适配任意尺寸新背景图） */
.scene-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  transition: all 0.3s ease;
  height: auto;
}

/* 顶部用户栏：欢迎在右下角 */
/* 用户栏 */
.user-bar {
  pointer-events: none;
}

.user-greeting {
  pointer-events: auto;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-gold);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
}

.user-greeting:hover {
  background: rgba(212, 175, 55, 0.2);
  transform: scale(1.05);
}

.user-info-container {
  pointer-events: auto;
}

/* 竖屏：欢迎用户在留言板下方 */
@media (orientation: portrait) {
  .user-bar {
    position: fixed;
    bottom: 10px;
    left: 4vw;
    right: auto;
    transform: none;
    z-index: 6000;
  }
  .user-bar .user-greeting {
    padding: 3px 10px;
  }
}

/* 横屏：欢迎用户在背景图片右下角 */
@media (orientation: landscape) {
  .user-bar {
    position: absolute;
    bottom: 2%;
    right: 2%;
    z-index: 6000;
  }
}

.user-greeting {
  pointer-events: auto;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-gold);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
}

.user-greeting:hover {
  background: rgba(212, 175, 55, 0.2);
  transform: scale(1.05);
}

.user-info-container {
  pointer-events: auto;
}

/* 用户信息弹出层 */
.user-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.user-info-modal-content {
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 10px;
  padding: 0;
  min-width: 0;
  width: auto;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.user-info-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  font-size: 13px;
  color: var(--text-gold);
  font-weight: bold;
}

.user-info-close {
  background: none;
  border: none;
  color: rgba(255, 215, 0, 0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  line-height: 1;
  transition: color 0.2s;
}

.user-info-close:hover {
  color: #ffd700;
}

.user-info-modal-body {
  padding: 10px 12px;
}

.info-item {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-item:last-child {
  margin-bottom: 0;
}

.family-id-item {
  background: rgba(212, 175, 55, 0.1);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  flex-wrap: wrap;
}

.info-label {
  font-size: 11px;
  color: rgba(255, 215, 0, 0.6);
  white-space: nowrap;
}

.info-value {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
}

.family-id-item .info-label {
  width: 100%;
  margin-bottom: 4px;
}

.family-id-item .info-value {
  color: #ffd700;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
}

.info-value-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.copy-id-btn {
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #ffd700;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.copy-id-btn:hover {
  background: rgba(212, 175, 55, 0.4);
}

.copy-id-btn.copied {
  background: rgba(85, 239, 196, 0.3);
  border-color: rgba(85, 239, 196, 0.5);
  color: #55efc4;
}

.user-info-modal-footer {
  padding: 8px 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.logout-btn-modal {
  width: 100%;
  padding: 6px;
  background: rgba(214, 48, 49, 0.15);
  border: 1px solid rgba(214, 48, 49, 0.4);
  color: #ff6b6b;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn-modal:hover {
  background: rgba(214, 48, 49, 0.4);
  transform: scale(1.02);
}

/* 背景图片包裹层：与图片同尺寸，氏系图按钮相对此层定位 = 相对背景图片 */
.scene-bg-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
  height: auto;
}

/* 背景图片用 img 撑开容器，画布比例完全跟随新图尺寸 */
.scene-bg {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 10px rgba(255, 210, 90, 0.75)) drop-shadow(0 0 24px rgba(255, 196, 46, 0.45)) !important;
  outline: 1px solid rgba(255, 213, 102, 0.85);
  outline-offset: 0;
}

/* 图片相对定位层：竖屏下填满 scene-bg-wrap（与背景图同尺寸） */
.scene-img-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* 牌位、入口等与背景图同坐标系 */
.scene-content {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* 牌位区域：百分比定位，与背景图保持固定关系 */
.tablet-frame {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tablet-inner {
  position: absolute;
  width: 35%;
  aspect-ratio: 560 / 978;
  left: 32.5%;
  top: 2%;
  overflow: hidden;
  container-type: inline-size;
}

.tablet-bg {
  width: 91.29%;
  height: 88.61%;
  position: absolute;
  left: 3.99%;
  top: 3%;
  border-radius: min(5vw, 3rem);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url(../images/pw.webp);
}

.tablet-text-wrap {
  width: 29.22%;
  height: 79.09%;
  position: absolute;
  left: 35.03%;
  top: 8.9%;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5%;
}

.tablet-text-main {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 900;
  text-align: center;
  width: 100%;
  color: var(--primary-color);
  text-shadow: 0 0.4% 0.4% rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.tablet-text-sub {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 900;
  text-align: center;
  width: 100%;
  color: var(--primary-color);
  text-shadow: 0 0.4% 0.4% rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  margin-top: 3%;
}

.tablet-text-main p,
.tablet-text-sub p {
  margin: 0;
  line-height: 1.3;
}

.tablet-kaobi {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 900;
  text-align: center;
  line-height: 1.2;
  color: var(--primary-color);
  width: 100%;
  text-shadow: 0 0.4% 0.4% rgba(0, 0, 0, 0.5);
  white-space: pre-wrap;
  overflow: hidden;
  font-size: 6cqw;
  margin-top: 3%;
  letter-spacing: -0.25em;
  transform: translateX(-0.125em);
}

.tablet-text-main,
.tablet-text-sub {
  overflow: hidden;
}

.tablet-text-main span,
.tablet-text-sub span {
  font-size: 9cqw;
  display: block;
  overflow: hidden;
  line-height: 1.1;
  letter-spacing: 0.05em;
}

/* 氏系图入口：宽度收缩到按钮；竖屏/横屏定位在各自 media 中，避免被覆盖 */
.genealogy-entry {
  position: absolute;
  width: fit-content;
  z-index: 1001;
  cursor: pointer;
}

.genealogy-entry img {
  display: block;
  border-radius: 0 !important;
  clip-path: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none;
  filter: brightness(1.16) saturate(1.18) drop-shadow(0 0 4px rgba(255, 220, 140, 0.24));
  animation: genealogyBreathFloat 4.6s ease-in-out infinite, genealogyBreathLight 4.6s ease-in-out infinite;
}

.genealogy-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #FFF8DC;
  border-radius: 5px;
  font-size: min(2vw, 14px);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.genealogy-entry:hover .genealogy-tooltip {
  opacity: 1;
}

@keyframes genealogyBreathFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.045); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes genealogyBreathLight {
  0%, 100% {
    filter: brightness(1.14) saturate(1.16) drop-shadow(0 0 4px rgba(255, 220, 140, 0.24));
    opacity: 0.98;
  }
  50% {
    filter: brightness(1.28) saturate(1.24) drop-shadow(0 0 12px rgba(255, 228, 160, 0.62)) drop-shadow(0 0 22px rgba(255, 200, 100, 0.42));
    opacity: 1;
  }
}


/* 统一在后面的“返回按钮”块里定义样式，这里移除重复定义 */

/* 香炉组统一尺寸（竖屏/横屏/中间尺寸同一套，避免切换时缩放导致香乱动） */
.incense-group {
  position: relative;
  width: 380px;
  height: 280px;
  min-height: 280px;
  max-width: 380px;
  max-height: 280px;
  margin: -170px auto 0;
  z-index: 8000;
  overflow: visible;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* 香画布与炉同宽，底对齐 wrapper，向上拉长让烟雾能画到顶（不裁切） */
.incense-bind-canvas {
  position: absolute;
  left: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: 450%; /* 与 JS bitmap 倍数一致，烟可通顶 */
  z-index: 10050;
  pointer-events: none; /* 必须穿透，否则只点到 canvas 下方半截 */
  touch-action: none; /* 不抢触摸，交给下层香炉 */
  display: block;
}

.incense-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.incense-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 场景底部容器：在场景容器内，背景图片下方，居中显示 */
.scene-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  padding: 10px 0;
  margin-top: 0;
  position: relative;
  transition: all 0.3s ease;
  height: auto;
  min-height: 0;
}

/* 线上祭祖按钮行：在场景底部容器内，居中显示 */
.worship-btn-row {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 9000;
  padding: 10px 0;
  margin: 0 auto;
  transition: all 0.3s ease;
}

.incense-burner {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  transform-origin: center bottom;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-image: url(../images/ding.webp);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  z-index: 8000;
  overflow: visible;
}

.incense-burner.show-incense-burner {
  opacity: 1;
  visibility: visible;
}

.worship-btn {
  position: relative;
  padding: min(3vw, 20px) min(6vw, 50px);
  font-size: min(4vw, 28px);
  color: var(--primary-color);
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid var(--primary-color);
  border-radius: 35px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 1px;
}

.worship-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  color: var(--text-gold);
  border-color: var(--text-gold);
  transform: scale(1.05);
}

/* ============================================
   返回按钮：固定在背景图片组左下角
   根据背景图片大小等比例缩放
   ============================================ */
.return-btn {
  position: absolute;
  left: 2%;
  bottom: 3%;
  /* 使用百分比尺寸，真正跟随背景图片容器一起缩放 */
  padding: 1.2% 2.5%;
  font-size: 1.8%;
  color: var(--primary-color);
  background: rgba(0, 0, 0, 0.7);
  border: 0.25% solid var(--primary-color);
  /* 圆角比上香按钮略小（用百分比，随容器缩放） */
  border-radius: 3%;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.15%;
  white-space: nowrap;
  box-shadow: 0 0.3% 1% rgba(212, 175, 55, 0.3);
}

.return-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  color: var(--text-gold);
  border-color: var(--text-gold);
  transform: scale(1.05);
  box-shadow: 0 0.5% 1.5% rgba(255, 215, 0, 0.5);
}

.return-btn:active {
  transform: scale(0.98);
}

.return-btn-text {
  display: block;
  font-weight: 500;
}

.incense-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: none;
  pointer-events: none;
}

.incense-stick {
  position: absolute;
  bottom: 78%;
  width: 2.3vw;
  height: 17vw;
  pointer-events: none;
}

.incense-stick.left { left: calc(50% - 5.8vw); }
.incense-stick.center { left: calc(50% - 1.2vw); }
.incense-stick.right { left: calc(50% + 3.5vw); }

.incense-body {
  width: 100%;
  height: 17vw;
  background: linear-gradient(to bottom, #8B4513, #A0522D);
  border-radius: 0.9vw;
  position: absolute;
  bottom: 0;
  overflow: visible;
  pointer-events: none;
  transform-origin: bottom center;
  will-change: transform;
}

/* 燃香动画 - 使用 transform scaleY 实现GPU加速 */
@keyframes burnIncense {
  from { transform: scaleY(1); }
  to { transform: scaleY(0.09); }
}

.incense-body.burning {
  animation: burnIncense var(--burn-duration, 15s) linear forwards;
}

.incense-tip {
  position: absolute;
  top: -0.9vw;
  left: 50%;
  transform: translateX(-50%);
  width: 2vw;
  height: 2vw;
  background: radial-gradient(circle, #FF4500, #FF6347, transparent);
  border-radius: 50%;
  animation: flicker 0.3s infinite alternate;
  box-shadow: 0 0 2vw #FF4500, 0 0 4vw #FF6347;
  display: none;
  pointer-events: none;
}

.smoke-container {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 400px;
  pointer-events: none;
  opacity: 1;
  overflow: visible;
  z-index: 10;
  transition: opacity 1s ease;
  display: none;
}

.smoke {
  position: absolute;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, rgba(220,220,220,0.6) 0%, rgba(200,200,200,0.3) 30%, transparent 70%);
  border-radius: 50%;
  animation: smoke-rise 10s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(200,200,200,0.3);
  /* 暂时禁用 blur 测试性能 */
  /* filter: blur(6px); */
}

@keyframes smoke-rise {
  0% { transform: translateY(0) scale(0.3); opacity: 0.85; }
  100% { transform: translateY(-320px) scale(1.5); opacity: 0; }
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(1.2); opacity: 0.8; }
}

.countdown {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  color: var(--primary-color);
  font-size: min(3vw, 24px);
  font-weight: bold;
  text-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 16px;
  border-radius: 25px;
  z-index: 20;
  display: none;
  border: 2px solid rgba(212, 175, 55, 0.5);
}

.incense-hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  padding: 8px 20px;
  font-size: min(5vw, 36px);
  color: var(--text-gold);
  border-radius: 999px;
  letter-spacing: 1px;
  display: none;
  white-space: nowrap;
  animation: incenseHintFloat 3s ease-in-out infinite;
}

@keyframes incenseHintFloat {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.2; }
  50% { transform: translate(-50%, -10px); opacity: 1; }
}

/* 三连弹动画：柔和弹三次，间隔0.5秒 */
@keyframes incenseHintBounce {
  0% { transform: translate(-50%, 0); opacity: 0.5; }
  3% { transform: translate(-50%, 0); opacity: 0.5; }
  10% { transform: translate(-50%, -3px); opacity: 1; }
  13% { transform: translate(-50%, -3px); opacity: 1; }
  20% { transform: translate(-50%, 0); opacity: 0.5; }
  25% { transform: translate(-50%, 0); opacity: 0.5; }
  32% { transform: translate(-50%, -3px); opacity: 1; }
  35% { transform: translate(-50%, -3px); opacity: 1; }
  42% { transform: translate(-50%, 0); opacity: 0.5; }
  47% { transform: translate(-50%, 0); opacity: 0.5; }
  54% { transform: translate(-50%, -3px); opacity: 1; }
  57% { transform: translate(-50%, -3px); opacity: 1; }
  64% { transform: translate(-50%, 0); opacity: 0.5; }
  70%, 100% { transform: translate(-50%, 0); opacity: 0.5; }
}

/* ========== 留言、弹窗、氏系图等（与原版一致） ========== */
.mobile-controls {
  pointer-events: none;
}

.mobile-controls > * { pointer-events: auto; }

/* ========== 留言板（样式继承自 copy 2 - 副本）========== */
.messages-clip {
  --drawer-width: min(35vw, 320px);
  --drawer-button: 22px;
  --show-button: 36px;
  --show-button-height: 140px;
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--drawer-width);
  height: min(85vh, 520px);
  overflow: hidden;
  z-index: 120;
  transition: width 0.35s ease, min-width 0.35s ease;
  display: flex;
  flex-direction: column;
}

/* 《谱牒序》：背景图片组右上角，横向滚动展示，渐隐渐现，随背景图等比例缩放 */
.pudie-board {
  position: absolute;
  top: 5%;
  right: 2%;
  z-index: 5;
  pointer-events: none;
  box-sizing: border-box;
  width: 15vw;
  max-width: 15%;
  min-width: 120px;
}

.pudie-board__viewport {
  width: 100%;
  height: 2vw;
  min-height: 1.5rem;
  max-height: 2.5rem;
  overflow: hidden;
  position: relative;
  /* 左右渐隐渐现效果 */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.8) 10%,
    black 20%,
    black 80%,
    rgba(0, 0, 0, 0.8) 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.8) 10%,
    black 20%,
    black 80%,
    rgba(0, 0, 0, 0.8) 90%,
    transparent 100%
  );
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.pudie-board__marquee-track {
  display: inline-flex;
  flex-wrap: nowrap;
  width: max-content;
  animation: pudie-marquee-left 60s linear infinite;
  will-change: transform;
}

.pudie-column {
  display: flex;
  align-items: center;
  margin: 0 0.8vw;
  min-margin: 6px;
  max-margin: 12px;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", serif;
  font-size: 1.2vw;
  min-font-size: 12px;
  max-font-size: 16px;
  color: rgba(255, 235, 200, 0.95);
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

@keyframes pudie-marquee-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* 竖屏模式：进一步限制谱牒序宽度，但文字更大 */
@media (orientation: portrait) {
  .pudie-board {
    width: 12vw;
    max-width: 12%;
    min-width: 100px;
  }
  
  .pudie-board__viewport {
    height: 2vw;
    min-height: 1.5rem;
    max-height: 2.5rem;
  }
  
  .pudie-column {
    font-size: 1.4vw;
    min-font-size: 13px;
    max-font-size: 16px;
    margin: 0 0.6vw;
    min-margin: 4px;
    max-margin: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pudie-board__marquee-track { animation: none; }
}

html.perf-lite .messages-show-toggle {
  animation: none !important;
}

html.perf-lite .pudie-board__marquee-track {
  animation-duration: 120s !important;
}

html.perf-lite .lantern:nth-child(1),
html.perf-lite .lantern:nth-child(2),
html.perf-lite .lantern:nth-child(3),
html.perf-lite .lantern:nth-child(4) {
  animation-duration: 60s !important;
}

html.perf-lite .lantern::after {
  animation: none !important;
  opacity: 0.35;
}

html.perf-lite .lantern img {
  filter: drop-shadow(0 0 8px rgba(255, 150, 50, 0.6));
}

html.perf-lite .modal,
html.perf-lite .modal-content,
html.perf-lite .tree-modal-header,
html.perf-lite .tree-modal-footer,
html.perf-lite .btn-tree,
html.perf-lite .cone-hint {
  backdrop-filter: none !important;
}

html.perf-lite .tree-modal-content::before {
  filter: none !important;
}

.messages-clip:has(.messages-module.drawer-collapsed) .pudie-board {
  display: none;
}

.messages-clip > .messages-module {
  flex: 1;
  min-height: 0;
}

.messages-module {
  --drawer-shift: 0px;
  position: relative;
  width: var(--drawer-width);
  transform: translateX(var(--drawer-shift));
  transition: transform 0.45s ease;
  display: flex;
  flex-direction: column;
}

.messages-module.drawer-collapsed {
  --drawer-shift: calc(-1 * var(--drawer-width) - 52px);
}

.messages-clip:has(.messages-module.drawer-collapsed) {
  width: 52px !important;
  min-width: 52px;
}

.messages-show-toggle {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: var(--primary-color);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 3;
  padding: 0;
  animation: messages-restore-bounce 2s ease-in-out infinite;
}

@keyframes messages-restore-bounce {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(calc(-50% - 4px)); }
}

.messages-module.drawer-collapsed + .messages-show-toggle { display: flex; }

.messages-show-toggle .messages-btn-icon--show {
  width: 22px;
  height: 22px;
}

.messages-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--primary-color);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 10px 10px 0 0;
  gap: 4px;
}

.messages-title {
  color: var(--primary-color);
  margin: 0;
  font-size: min(2.5vw, 16px);
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

.messages-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.messages-body-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.messages-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--primary-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  cursor: grab;
  touch-action: pan-y;
  box-sizing: border-box;
  direction: rtl;
}

.messages-list {
  direction: ltr;
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 100%;
  height: auto;
}

.messages-module.drawer-collapsed .messages-container { padding-right: 10px; }
.messages-container.dragging { cursor: grabbing; }

.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.6);
  border-radius: 6px;
}

.message-item {
  margin: 0 0 5px 0;
  padding: 8px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: 5px;
  border-left: 3px solid var(--primary-color);
  flex-shrink: 0;
  min-height: 40px;
  height: auto;
  line-height: 1.4;
  overflow: hidden;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: break-all;
}

.message-user {
  font-weight: bold;
  color: var(--text-gold);
  margin-bottom: 3px;
  font-size: min(2.2vw, 15px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-content {
  color: #fff;
  margin-bottom: 3px;
  font-size: min(2.2vw, 15px);
  line-height: 1.4;
  overflow: hidden;
  word-wrap: break-word;
  word-break: break-all;
}

.message-time {
  font-size: min(1.7vw, 11px);
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.messages-drawer-toggle {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: background 0.2s, color 0.2s;
}

.messages-drawer-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.messages-drawer-toggle .messages-btn-icon--hide {
  width: 18px;
  height: 18px;
  color: rgba(212, 175, 55, 0.8);
}

.message-manager-btn.messages-header-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: background 0.2s, color 0.2s;
}

.message-manager-btn.messages-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.message-manager-btn.messages-header-btn .messages-btn-icon--manager {
  width: 18px;
  height: 18px;
  color: rgba(212, 175, 55, 0.8);
}

.messages-module.drawer-collapsed .messages-drawer-toggle { display: none; }

.drawer-text {
  font-size: min(2.5vw, 16px);
  line-height: 1.05;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  text-align: center;
  transform: translateX(-2px);
}

.message-manager-btn {
  padding: 8px 20px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 4px;
  color: var(--primary-color);
  font-size: min(2vw, 14px);
  cursor: pointer;
  transition: all 0.3s;
}

/* 竖屏窄屏：留言板在底部 */
@media (orientation: portrait) and (max-aspect-ratio: 5/6) {
  .mobile-controls--landscape {
    display: none !important;
  }
  .mobile-controls--portrait {
    display: flex !important;
    margin-top: 20px !important;
  }
  .mobile-controls--portrait .messages-clip {
    margin-top: 4px;
  }
}

/* 竖屏接近正方形：留言板在左侧，相对于背景图垂直居中 */
@media (orientation: portrait) and (min-aspect-ratio: 5/6) {
  .mobile-controls--portrait {
    display: none !important;
  }
  .mobile-controls--landscape {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8000;
  }
  .mobile-controls--landscape > * {
    pointer-events: auto;
  }
  .mobile-controls--landscape .messages-clip {
    --drawer-width: 22vw;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--drawer-width);
    max-width: 200px;
    height: 45vh;
    max-height: 300px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
  }
  /* 竖版宽屏留言板内容自适应缩小 */
  .mobile-controls--landscape .messages-header-row {
    padding: 4px 6px;
  }
  .mobile-controls--landscape .messages-title {
    font-size: 10px;
  }
  .mobile-controls--landscape .messages-drawer-toggle,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
  }
  .mobile-controls--landscape .messages-drawer-toggle .messages-btn-icon--hide,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn .messages-btn-icon--manager {
    width: 14px;
    height: 14px;
  }
  .mobile-controls--landscape .messages-container {
    padding: 6px;
  }
  .mobile-controls--landscape .message-item {
    padding: 4px;
    margin-bottom: 4px;
    min-height: 30px;
  }
  .mobile-controls--landscape .message-user {
    font-size: 10px;
    margin-bottom: 2px;
  }
  .mobile-controls--landscape .message-content {
    font-size: 10px;
    margin-bottom: 2px;
    line-height: 1.2;
  }
  .mobile-controls--landscape .message-time {
    font-size: 8px;
  }
}

/* 竖屏：整版布局与 copy 2 - 副本 完全一致（背景图随宽、牌位统一缩放、留言板在 page-wrap 内）*/
@media (orientation: portrait) {
  /* 牌位增大0.2倍 */
  .tablet-inner {
    width: 42% !important;
    left: 29% !important;
    top: 2% !important;  /* 重置为基础样式的top值 */
    transform: none !important;  /* 重置transform，使用left/top定位 */
  }
  /* 竖屏文字容器调整 - 独立布局 */
  .tablet-text-wrap {
    width: 85% !important;
    left: 7.5% !important;
    top: 2% !important;
    height: 90% !important;
    justify-content: center;
    gap: 2% !important;
    padding: 0;
  }
  .tablet-text-main {
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    flex: 0 0 auto !important;
  }
  .tablet-kaobi {
    width: 100% !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    margin: 1% 0 0 0;
    letter-spacing: -0.25em !important;
    transform: translateX(-0.125em) !important;
  }
  .tablet-text-sub {
    width: 100% !important;
    height: auto !important;
    margin-top: -1% !important;
    flex: 0 0 auto !important;
  }
  /* 字体大小使用基础样式的 cqw 单位，绑定到牌位 */
  .tablet-text-main span,
  .tablet-text-sub span {
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
  }
  /* 竖屏隐藏横屏香炉组和按钮 */
  .incense-group--landscape {
    display: none !important;
  }
  .worship-btn-row--landscape {
    display: none !important;
  }
  .page-wrap {
    padding-top: var(--scene-top);
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    flex: 1;
  }
  .scene-container {
    flex: 0 1 auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 5300;
    min-height: 0;
    width: 100%;
    height: auto;
  }
  .scene-bg-wrap {
    position: relative;
    width: 100%;
    min-height: 0;
    flex-shrink: 0;
    height: auto;
  }
  /* 竖屏：背景图始终按宽度等比例缩放，不因容器高度限制而缩小宽度 */
  .scene-bg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    vertical-align: top;
    object-position: top center;
  }
  /* 场景底部容器：在场景容器内，背景图片下方，居中显示 */
  .scene-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 0 1 auto;
    padding: 10px 0;
    margin-top: 0;
    position: relative;
    transition: all 0.3s ease;
    min-height: 0;
    max-height: calc(100vh - 60vw);
    /* 不再用 container-type/cqw：cqw 曾把宽度算死或恒顶格，导致不随宽变；改回纯 vw */
  }
  /* 线上祭祖按钮行：在背景图片下方，居中显示 */
  .worship-btn-row {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* z-index 高于香炉，但整行不设命中，避免大 gap 盖住炉上沿导致点不到炉 */
    z-index: 9000;
    padding: 5px 0;
    margin: 0 auto;
    gap: 10px;
    pointer-events: none;
  }
  /* 竖屏操作按钮统一样式 */
  .worship-btn-row .action-btn {
    padding: 6px 14px;
    font-size: 13px;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.7);
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* 仅按钮可点，献花/掌灯/上香不受影响；行间空白穿透到香炉 */
    pointer-events: auto;
    position: relative;
    z-index: 1;
  }
  .worship-btn-row .action-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--text-gold);
    border-color: var(--text-gold);
  }
  .worship-btn-row .action-btn.active {
    background: rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 10px rgba(255, 150, 50, 0.4);
  }
  /* 竖屏香炉出现时按钮分两侧；gap 与炉宽同一套 clamp，避免只改一处错位 */
  .worship-btn-row.has-incense {
    gap: calc(clamp(200px, 62vw, 320px) + 40px);
  }
  .worship-btn-row.has-incense .action-btn--worship {
    display: none;
  }
  .worship-btn-row .worship-btn {
    font-size: 14px !important;
    padding: 10px 18px !important;
    border-width: 2px !important;
  }
  /*
   * 竖屏香炉宽度：只用 vw + clamp，保证一定随视口宽变化。
   * 最小 200px 不变；62vw 线性随宽；最大 320px 避免窄屏也被顶得很大。
   * flex: 0 0 auto 防止 flex 子项被拉伸成父宽导致“看起来不缩放”。
   */
  .incense-group {
    position: relative;
    width: clamp(200px, 62vw, 320px) !important;
    max-width: none !important;
    min-width: 200px !important;
    aspect-ratio: 260 / 192;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-top: calc(-1 * clamp(200px, 62vw, 320px) * 128 / 260 - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 0 !important;
    transform: none;
    bottom: auto;
    left: auto;
    z-index: 8000;
    overflow: visible;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
    align-self: center;
    box-sizing: border-box;
  }
  .incense-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
  }
  /* 必须 absolute 铺满 wrapper，否则 relative 时只占内容高度，触摸只在下半截 */
  .incense-burner {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    transform: none;
    transform-origin: center bottom;
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-image: url(../images/ding.webp);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 8000;
    /* 整块炉区可点；canvas 在上层但 pointer-events:none，事件落到本层 */
    touch-action: manipulation;
  }

  .incense-burner.show-incense-burner {
    opacity: 1;
    visibility: visible;
  }
  /* 香容器 */
  .incense-container {
    transform: none;
    transform-origin: center top;
  }

  .incense-group .incense-stick {
    height: 10vw !important;
    width: 1.4vw !important;
    bottom: 85% !important;
  }

  .incense-group .incense-stick.left { left: calc(50% - 3.5vw) !important; }
  .incense-group .incense-stick.center { left: calc(50% - 0.7vw) !important; }
  .incense-group .incense-stick.right { left: calc(50% + 2.1vw) !important; }

  .incense-group .incense-body {
    height: 10vw !important;
    width: 100% !important;
    border-radius: 0.5vw !important;
  }

  .incense-group .incense-tip {
    width: 1.2vw !important;
    height: 1.2vw !important;
    top: -0.5vw !important;
    box-shadow: 0 0 1.2vw #FF4500, 0 0 2.4vw #FF6347 !important;
  }
  
  .smoke-container {
    width: 6vw;
    height: 60vw;
    pointer-events: none;
  }
  
  .smoke {
    width: 5vw;
    height: 5vw;
  }
  
  @keyframes smoke-rise {
    0% { transform: translateY(0) scale(0.3); opacity: 0.85; }
    100% { transform: translateY(-85vw) scale(1.5); opacity: 0; }
  }
  /* 倒计时：在香炉底部 */
  .incense-burner .countdown {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    font-size: 2.5vw;
    padding: 0.5vw 1.5vw;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 2vw;
    border: 0.3vw solid rgba(212, 175, 55, 0.5);
    z-index: 8001;
    pointer-events: none;
  }
  /* 点击香炉上香提示：在香炉底部，纯文字浮动效果 */
  .incense-burner .incense-hint {
    position: absolute;
    left: 50%;
    bottom: -1.5vw;
    transform: translateX(-50%);
    font-size: 2.5vw;
    color: var(--text-gold);
    white-space: nowrap;
    z-index: 8001;
    pointer-events: none;
    animation: incenseHintBounce 3s ease-in-out infinite;
  }
  .mobile-controls--portrait {
    position: relative;
    z-index: 1000;
    flex: 1 1 auto;
    min-height: 100px;
    margin-top: 10px;
    margin-bottom: 35px;
    width: 100%;
    left: 0;
    top: auto;
    right: auto;
    bottom: auto;
    inset: unset;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
  }
  /* 竖屏留言板样式（显示控制已在上面的 min-height: 794px 规则中定义）*/
  /* 竖屏留言板：用 flex 占满分配到的空间，覆盖全局 height: min(85vh,520px) */
  .mobile-controls--portrait .messages-clip {
    --drawer-width: 92vw;
    left: auto;
    top: auto;
    bottom: auto;
    transform: none;
    position: relative;
    width: 92vw;
    max-width: 92vw;
    height: auto;
    min-height: 0;
    max-height: none;
    flex: 1 1 0;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .mobile-controls--portrait .messages-module {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .mobile-controls--portrait .messages-module .messages-stack {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .mobile-controls--portrait .messages-body-wrap {
    flex: 1 1 0;
    min-height: 48px;
    height: auto;
    overflow: auto;
  }
  .mobile-controls--portrait .messages-header-row {
    padding: 6px 8px;
    flex-shrink: 0;
  }
  .mobile-controls--portrait .messages-title {
    font-size: min(2.2vw, 14px);
    white-space: nowrap;
  }
  .mobile-controls--portrait:has(.messages-module.drawer-collapsed) {
    flex: 0 0 auto;
    max-height: 56px;
    min-height: 56px;
  }
  .mobile-controls--portrait:has(.messages-module.drawer-collapsed) .messages-clip {
    height: 56px;
    max-height: 56px;
  }
  
  /* 竖屏：返回按钮保持等比例缩放 */
  .return-btn {
    left: 2%;
    bottom: 2%;
  }
}

/* 横屏：留言板规则 */
@media (orientation: landscape) {
  .mobile-controls--portrait {
    display: none !important;
  }
  .mobile-controls--landscape {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    z-index: 5200;
  }
  .mobile-controls--landscape > * {
    pointer-events: auto;
  }
  .mobile-controls--landscape .messages-clip {
    --drawer-width: min(20%, 280px);
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--drawer-width);
    height: 50%;
    max-height: 420px;
    display: flex;
    flex-direction: column;
  }
  
  .mobile-controls--landscape .messages-module {
    width: 100%;
    height: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .mobile-controls--landscape .messages-stack {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .mobile-controls--landscape .messages-body-wrap {
    flex: 1 1 0;
    min-height: 48px;
    height: auto;
    overflow: auto;
  }
  
  /* 横屏放大元素以适配更大屏幕 */
  .mobile-controls--landscape .messages-header-row {
    padding: 10px 12px;
    border-radius: 10px 10px 0 0;
    border-width: 1px;
  }
  
  .mobile-controls--landscape .messages-title {
    font-size: 14px;
    white-space: nowrap;
  }
  
  .mobile-controls--landscape .messages-drawer-toggle,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
    border: none;
  }
  
  .mobile-controls--landscape .messages-drawer-toggle .messages-btn-icon--hide,
  .mobile-controls--landscape .message-manager-btn.messages-header-btn .messages-btn-icon--manager {
    width: 20px;
    height: 20px;
  }
  
  .mobile-controls--landscape .messages-container {
    padding: 12px;
    border-radius: 0 0 10px 10px;
    border-width: 1px;
  }
  
  .mobile-controls--landscape .messages-container::-webkit-scrollbar {
    width: 6px;
  }
  
  .mobile-controls--landscape .messages-container::-webkit-scrollbar-thumb {
    border-radius: 3px;
  }
  
  .mobile-controls--landscape .message-item {
    padding: 7px;
    margin: 0 0 6px 0;
    border-radius: 5px;
    border-left-width: 2px;
    min-height: 36px;
  }
  
  .mobile-controls--landscape .message-user {
    font-size: 11px;
    margin-bottom: 0;
    width: 56px;
  }
  
  .mobile-controls--landscape .message-content {
    font-size: 11px;
    margin-bottom: 0;
    line-height: 1.35;
  }
  
  .mobile-controls--landscape .message-time {
    font-size: 9px;
  }
  
  .mobile-controls--landscape .messages-show-toggle {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
  }
  
  .mobile-controls--landscape .messages-show-toggle .messages-btn-icon--show {
    width: 24px;
    height: 24px;
  }
}

/* 横屏：氏系图在背景图内显示（完全继承自 copy 2 - 副本）*/
@media (orientation: landscape) {
  .genealogy-entry--portrait {
    display: none !important;
  }
  .genealogy-entry--landscape {
    display: block;
  }
  .genealogy-entry--landscape {
    position: absolute !important;
    top: 2.2%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .genealogy-entry--landscape img {
    width: clamp(86px, 12vw, 140px);
    height: auto;
    aspect-ratio: 1;
    min-width: 86px;
    min-height: 86px;
    transition: width 0.25s ease, height 0.25s ease;
  }
}

/* 中间尺寸横版：仍使用背景图组内的山海图入口 */
@media (orientation: landscape) and (max-aspect-ratio: 4/3) {
  .genealogy-entry--portrait {
    display: none !important;
  }
  .genealogy-entry--landscape {
    display: block !important;
  }
  .scene-bg-wrap > .genealogy-entry--landscape {
    top: 2.2% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  .scene-bg-wrap > .genealogy-entry--landscape img {
    width: clamp(86px, 12vw, 140px) !important;
    min-width: 86px;
    min-height: 86px;
    height: auto;
  }
}

/* 弹窗通用 - 注意：Family Tree Modal Styles 部分有完整的 .modal 定义 */
/* 这里只保留特定弹窗的样式覆盖 */

/* 确保弹窗中的按钮可点击 */
.speed-btn {
  position: relative;
  z-index: 15002;
}

.submit-btn {
  position: relative;
  z-index: 15002;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.modal-title { color: var(--primary-color); font-size: min(4vw, 20px); font-weight: bold; }

.close-speed, .close {
  color: var(--primary-color);
  font-size: min(5vw, 28px);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.speed-modal-body { text-align: center; padding: 10px; }
.speed-hint { color: var(--primary-color); font-size: min(3vw, 16px); margin-bottom: 15px; font-weight: 500; }
.speed-desc {
  color: #ccc;
  font-size: min(2.5vw, 14px);
  line-height: 1.6;
  margin-top: 15px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.speed-buttons { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }

.speed-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 5px;
  font-size: min(3vw, 16px);
  cursor: pointer;
  transition: all 0.3s ease;
}

.speed-btn.fast { background: linear-gradient(to right, #ff6b6b, #ff8e8e); color: white; }
.speed-btn.normal { background: linear-gradient(to right, #d4af37, #b8860b); color: #1a1a2e; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--primary-color); }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--primary-color);
  border-radius: 5px;
  color: #fff;
}

.quick-messages { margin-bottom: 15px; }
.quick-message-btn {
  display: inline-block;
  padding: 5px 10px;
  margin: 0 5px 5px 0;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--primary-color);
  border-radius: 15px;
  color: var(--primary-color);
  font-size: min(2vw, 14px);
  cursor: pointer;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(to right, #d4af37, #b8860b);
  border: none;
  border-radius: 5px;
  color: #1a1a2e;
  font-size: min(3vw, 16px);
  font-weight: bold;
  cursor: pointer;
}

.blessing-modal {
  display: none;
  position: fixed;
  z-index: 20000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.blessing-modal.show { display: flex; animation: blessingFadeIn 0.5s ease-out; }
.blessing-text {
  font-size: min(12vw, 72px);
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.8), 0 0 40px rgba(212, 175, 55, 0.6);
  text-align: center;
  animation: blessingPulse 2s infinite;
  margin-bottom: 1rem;
}
.blessing-subtext { font-size: min(5vw, 30px); color: rgba(255, 255, 255, 0.8); text-align: center; }
@keyframes blessingFadeIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes blessingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 氏系图弹窗 */
.genealogy-modal {
  display: none;
  position: fixed;
  z-index: 19999;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}

.genealogy-modal.show { display: flex; }

.genealogy-content {
  background: #111;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.genealogy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.genealogy-title { color: var(--primary-color); font-size: min(4vw, 20px); font-weight: bold; }
.genealogy-close { color: var(--primary-color); background: none; border: none; font-size: min(5vw, 26px); cursor: pointer; }

.genealogy-tabs { display: flex; border-bottom: 1px solid rgba(212, 175, 55, 0.3); }
.genealogy-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: min(3vw, 16px);
}
.genealogy-tab.active { color: var(--primary-color); background: rgba(212, 175, 55, 0.1); }

.genealogy-body { flex: 1; overflow: auto; padding: 20px; background-color: #f5f5dc; }
.genealogy-footer { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid rgba(212, 175, 55, 0.3); background: rgba(212, 175, 55, 0.08); }
.genealogy-admin-btn {
  padding: 8px 16px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: min(2.5vw, 14px);
}

.clan-history {
  background-color: #fff;
  border: 2px solid #8b4513;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}
.clan-history h3 { color: #8b4513; margin-bottom: 15px; text-align: center; font-size: min(4vw, 22px); }
.clan-history-content { font-size: min(3vw, 16px); line-height: 1.6; color: #333; white-space: pre-wrap; }

.lineage-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: #fff;
  border: 2px solid #8b4513;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}
.lineage-levels { position: relative; width: 100%; min-height: 500px; }
.level-row { display: flex; justify-content: center; margin-bottom: 80px; position: relative; flex-wrap: wrap; gap: 20px; }
.level-label {
  position: absolute;
  left: -50px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #8b4513;
  color: #f5f5dc;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
  white-space: nowrap;
  font-size: min(2vw, 12px);
}
.level-cards { display: flex; justify-content: center; gap: 20px; position: relative; flex-wrap: wrap; }
.ancestor-card {
  background-color: #fff;
  border: 2px solid #8b4513;
  border-radius: 8px;
  padding: 15px;
  width: min(25vw, 150px);
  text-align: center;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}
.ancestor-card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); }
.ancestor-card.selected { background-color: #f5deb3; border-color: #ff6b35; }
.ancestor-name { font-weight: bold; margin-bottom: 5px; font-size: min(3vw, 16px); color: #5d4037; }
.branch-name { font-style: italic; color: #8b4513; font-size: min(2.5vw, 14px); margin-bottom: 5px; }
.generation-info { font-size: min(2vw, 12px); color: #666; }
.connections-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.connection-line { stroke: #8b4513; stroke-width: 2; fill: none; }

/* 管理面板 */
.admin-panel, .clan-history-panel {
  display: none;
  position: fixed;
  z-index: 4000;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  align-items: center;
  justify-content: center;
}
.admin-panel.show, .clan-history-panel.show { display: flex; }

.admin-panel-content, .clan-history-content-panel {
  background: #111;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  width: 95%;
  max-width: 700px;
  max-height: 85vh;
  overflow: auto;
}
.admin-panel-header, .clan-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}
.admin-panel-title, .clan-history-title { color: var(--primary-color); font-size: min(4vw, 18px); font-weight: bold; }
.admin-panel-close, .clan-history-close { background: none; border: none; color: rgba(255, 255, 255, 0.7); font-size: min(4vw, 20px); cursor: pointer; }
.admin-panel-body, .clan-history-body { padding: 15px; }
.admin-section { margin-bottom: 15px; }
.admin-input-group { margin-bottom: 10px; }
.admin-input-group label { display: block; margin-bottom: 6px; color: var(--primary-color); font-size: min(2.5vw, 14px); }
.admin-input-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: min(2.5vw, 14px);
}
.admin-action-btn {
  padding: 8px 16px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.2);
  color: var(--primary-color);
  border-radius: 6px;
  cursor: pointer;
  margin-right: 8px;
  font-size: min(2.5vw, 14px);
}
.admin-action-btn.secondary { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.8); }
.admin-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.connect-status { color: rgba(255, 255, 255, 0.7); font-size: min(2vw, 12px); }
.clan-history-textarea {
  width: 100%;
  min-height: 200px;
  padding: 10px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  resize: vertical;
  font-size: min(2.5vw, 14px);
}
.clan-history-footer { display: flex; justify-content: flex-end; padding: 12px 15px; border-top: 1px solid rgba(212, 175, 55, 0.3); }

/* 留言管理弹窗 */
.message-manager-modal-wrapper {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  overflow: auto;
  padding: 20px;
  box-sizing: border-box;
}
.message-manager-content {
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
}
.message-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.1);
}
.message-manager-header h3 { margin: 0; color: var(--primary-color); font-size: min(3.5vw, 16px); font-weight: bold; }
.message-manager-body { flex: 1; overflow-y: auto; padding: 10px 15px; background: rgba(0, 0, 0, 0.3); min-height: 0; }
.message-manager-item {
  display: flex;
  align-items: flex-start;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  background: rgba(0, 0, 0, 0.2);
}
.message-checkbox { margin-top: 3px; margin-right: 10px; cursor: pointer; width: 16px; height: 16px; accent-color: var(--primary-color); }
.message-info { flex: 1; min-width: 0; }
.message-text { color: rgba(255, 255, 255, 0.9); font-size: min(2.5vw, 13px); margin-bottom: 3px; word-break: break-all; line-height: 1.4; }
.message-date { color: rgba(255, 255, 255, 0.5); font-size: min(2vw, 11px); }
.message-manager-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 15px;
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.1);
}
.delete-selected-btn {
  padding: 6px 15px;
  background: rgba(255, 107, 107, 0.2);
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 4px;
  color: #ff6b6b;
  font-size: min(2.5vw, 13px);
  cursor: pointer;
}
.cancel-btn {
  padding: 6px 15px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  font-size: min(2.5vw, 13px);
  cursor: pointer;
}

/* 极窄横屏时氏系图入口样式 */
@media (orientation: landscape) and (max-aspect-ratio: 6/5) {
  .genealogy-entry--landscape { top: 2.2%; left: 50%; right: auto; transform: translateX(-50%); }
  .messages-body-wrap { height: min(40vh, 200px); }
}

/* ========================================
   留言板显示逻辑控制
   ======================================== */

/* 竖屏宽屏时的留言板（在背景图左侧）- 默认隐藏 */
.message-board-portrait-wide {
  display: none;
}

/* 横屏：隐藏竖屏宽屏留言板和底部留言板 */
@media (orientation: landscape) {
  .message-board-portrait-wide {
    display: none !important;
  }
  .mobile-controls--portrait {
    display: none !important;
  }
}

/* 竖屏：显示策略已在上面的规则中定义（min-height: 794px 和 max-height: 793px）*/

/* 字体选择器 */
.font-selector {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10000;
}
#tabletFontSelect {
  padding: 5px 10px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #d4af37;
  border: 1px solid #d4af37;
  border-radius: 5px;
  cursor: pointer;
}
#tabletFontSelect option {
  background: #1a1a2e;
  color: #d4af37;
}

/* 牌位文字使用中华薪火体 */
.tablet-text-wrap,
.tablet-text-main,
.tablet-text-sub,
.tablet-kaobi,
.tablet-text-main span,
.tablet-text-sub span,
.tablet-kaobi span {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
  .tablet-kaobi {
    letter-spacing: 0.08em !important;
    transform: none !important;
    text-align: center !important;
  }
}

/* 华为鸿蒙系统优化 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  @supports (-webkit-touch-callout: none) and (not (translate: none)) {
    .tablet-kaobi {
      letter-spacing: 0.08em !important;
      font-family: "HarmonyOS Sans", "Huawei Sans", "PingFang SC", "Microsoft YaHei", sans-serif !important;
      transform: none !important;
    }
  }
}

/* 华为设备特定优化 */
@media screen and (min-width: 0px) and (max-width: 480px) {
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .tablet-kaobi {
      letter-spacing: 0.08em !important;
      font-family: "HarmonyOS Sans", "Huawei Sans", "PingFang SC", "Microsoft YaHei", sans-serif !important;
    }
  }
}

/* 献花动画 */
@keyframes flowerFloat {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.9;
  }
  100% {
    transform: translateY(-120vh) rotate(360deg);
    opacity: 0;
  }
}

.flower-petal {
  will-change: transform, opacity;
}

/* 灯笼飞行特效 */
.lanterns-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
  display: none;
}

.lanterns-container.active {
  display: block;
}

.lantern {
  position: absolute;
  width: 8%;
  min-width: 60px;
  max-width: 120px;
  bottom: 5%;
  opacity: 0;
}

/* 左右灯笼：从左右下角同时出发，直线向上 */
.lantern:nth-child(1) {
  left: 6%;
  animation: lanternFlyUpLeft 22s linear infinite;
  animation-delay: 0s;
}
.lantern:nth-child(2) {
  left: 12%;
  animation: lanternFlyUpLeft 22s linear infinite;
  animation-delay: 11s;
}

.lantern:nth-child(3) {
  right: 6%;
  animation: lanternFlyUpRight 22s linear infinite;
  animation-delay: 0s;
}
.lantern:nth-child(4) {
  right: 12%;
  animation: lanternFlyUpRight 22s linear infinite;
  animation-delay: 11s;
}

@keyframes lanternFlyUpLeft {
  0% {
    bottom: 4%;
    left: 6%;
    opacity: 0;
    transform: scale(1.25);
  }
  8% {
    opacity: 1;
  }
  90% {
    bottom: 92%;
    left: 6%;
    opacity: 1;
    transform: scale(0.55);
  }
  100% {
    bottom: 100%;
    left: 6%;
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes lanternFlyUpRight {
  0% {
    bottom: 4%;
    right: 6%;
    opacity: 0;
    transform: scale(1.25);
  }
  8% {
    opacity: 1;
  }
  90% {
    bottom: 92%;
    right: 6%;
    opacity: 1;
    transform: scale(0.55);
  }
  100% {
    bottom: 100%;
    right: 6%;
    opacity: 0;
    transform: scale(0.4);
  }
}

.lantern img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(255, 150, 50, 0.9)) drop-shadow(0 0 40px rgba(255, 100, 0, 0.6));
}

/* 灯笼灯光效果 */
.lantern::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 150, 50, 0.4) 0%, transparent 70%);
  pointer-events: none;
  animation: lanternGlow 2s ease-in-out infinite alternate;
}

@keyframes lanternGlow {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* 掌灯按钮 */
.lantern-toggle-btn {
  position: absolute;
  top: 50%;
  right: 2%;
  transform: translateY(-50%);
  z-index: 500;
  padding: 10px 18px;
  font-size: min(2vw, 14px);
  color: #d4af37;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #d4af37;
  border-radius: 20px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s ease;
}

.lantern-toggle-btn:hover {
  background: rgba(212, 175, 55, 0.3);
  transform: translateY(-50%) scale(1.05);
}

.lantern-toggle-btn.active {
  background: rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 15px rgba(255, 150, 50, 0.5);
  transform: translateY(-50%);
}

/* 掌灯按钮和灯笼在所有尺寸都显示 */
@media (orientation: portrait) {
  .lantern-toggle-btn {
    display: none !important;
  }
}

@media (orientation: landscape) {
  .lantern-toggle-btn {
    display: none !important;
  }
}



/* 献花按钮冷却状态 */
.action-btn--flower.cooldown {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #666 0%, #444 100%);
}

.action-btn--flower.cooldown .btn-text {
  color: #aaa;
}

/* 祭拜提示 Toast */
.worship-hint-toast {
  animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* ==================== My Messages Modal ==================== */
.my-messages-modal-content {
  max-width: 760px;
}

.my-messages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.my-messages-hint {
  color: rgba(212, 175, 55, 0.8);
  font-size: 0.875rem;
}

.my-messages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

.my-message-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 10px;
  padding: 12px;
}

.my-message-content {
  color: #fff;
  line-height: 1.55;
  word-break: break-word;
  margin-bottom: 8px;
}

.my-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.my-message-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
}

.my-message-delete {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  cursor: pointer;
  font-size: 0.78rem;
}

.my-message-delete:hover {
  background: rgba(239, 68, 68, 0.22);
}

.my-messages-empty {
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  padding: 24px 10px;
}

/* ==================== Family Tree Modal Styles ==================== */
/* Modal Base */
.modal {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal.active {
    display: flex;
}

/* 家族树主模态框强制最高层，避免横屏被入口按钮压层 */
#familyTreeModal,
#familyTreeModal.show,
#familyTreeModal.active {
    z-index: 31000 !important;
}

/* 子模态框需要更高的 z-index，确保在家族树模态框之上 */
#memberFormModal,
#spouseFormModal,
#applyPermissionModal {
    z-index: 31001 !important;
}

#memberManageModal {
    z-index: 31001 !important;
}

/* 确保模态框内的按钮可点击 */
.modal-footer .btn,
.modal-footer button {
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(145deg, rgba(122, 62, 38, 0.95), rgba(72, 30, 22, 0.98));
    backdrop-filter: blur(40px);
    border: 2px solid #d4af37;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 22px 68px rgba(18, 8, 6, 0.42);
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-content.modal-fullscreen {
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-sm {
    max-width: 400px;
}

/* 祭祀弹窗样式 - 覆盖家族树模态框样式 */
#speedModal .modal-content,
#ancestorModal .modal-content {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: none;
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    color: #fff;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #d4af37;
}

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

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0a2525;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    color: #d4af37;
    border: 1px solid #d4af37;
}

.btn-outline:hover {
    background: rgba(212, 175, 55, 0.2);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(212, 175, 55, 0.8);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 0.875rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.radio-group {
    display: flex;
    gap: 24px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #d4af37;
    font-size: 0.875rem;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #d4af37;
}

/* Tree Modal */
.tree-modal-content {
    background: radial-gradient(circle at center, rgba(163, 141, 75, 0.95) 0%, rgba(121, 103, 48, 0.96) 48%, rgba(47, 37, 19, 0.98) 100%);
    border: 2px solid #d4af37;
    position: relative;
}

.tree-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 33%;
    background: rgba(255, 230, 168, 0.08);
    filter: blur(60px);
    pointer-events: none;
}

.tree-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.6);
    background: linear-gradient(135deg, rgba(163, 141, 75, 0.36) 0%, rgba(121, 103, 48, 0.5) 100%);
    backdrop-filter: blur(40px);
}

.tree-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tree-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a2525;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.tree-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #d4af37;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.tree-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-tree {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(121, 103, 48, 0.45);
    border: 1px solid #d4af37;
    color: #ffd700;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.22);
}

.btn-tree:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: translateY(-1px);
}

.btn-tree.is-active {
    background: rgba(212, 175, 55, 0.35);
    border-color: rgba(212, 175, 55, 0.95);
    color: #ffe7a3;
}

.btn-tree.btn-close:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #fca5a5;
}

.btn-tree.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #fca5a5;
}

.btn-tree.active {
    background: rgba(212, 175, 55, 0.3);
}

.btn-tree .btn-text {
    display: none;
}

@media (min-width: 768px) {
    .btn-tree .btn-text {
        display: inline;
    }
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(212, 175, 55, 0.3);
    margin: 0 4px;
}

.zoom-text {
    font-size: 0.75rem;
    color: #d4af37;
    min-width: 50px;
    text-align: center;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(42, 107, 107, 0.4);
    border-radius: 8px;
}

.tree-modal-body {
    flex: 1;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(42, 107, 107, 0.2) 0%, rgba(10, 37, 37, 0.3) 100%);
    border-bottom: 2px solid rgba(212, 175, 55, 0.6);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px;
    overflow: auto;
}

.tree-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(42, 107, 107, 0.4) 0%, rgba(31, 79, 79, 0.5) 100%);
    backdrop-filter: blur(40px);
}

.tree-hint {
    font-size: 0.875rem;
    color: rgba(212, 175, 55, 0.7);
}

/* Cone Hint */
.cone-hint {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(42, 107, 107, 0.95) 0%, rgba(31, 79, 79, 0.97) 100%);
    backdrop-filter: blur(40px);
    border: 2px solid #d4af37;
    border-radius: 12px;
    z-index: 10;
    animation: bounce 2s infinite;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.cone-hint svg {
    color: #d4af37;
}

.cone-hint span {
    color: #d4af37;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-hint {
    padding: 6px 12px;
    background: #d4af37;
    color: #0a2525;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-hint:hover {
    filter: brightness(1.1);
}

.btn-hint-close {
    padding: 4px;
    background: transparent;
    border: none;
    color: #d4af37;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-hint-close:hover {
    opacity: 1;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

/* Family Tree Styles */
.tree-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 80px;
    padding: 20px;
    cursor: grab;
    min-width: 100%;
    box-sizing: border-box;
}

.tree-container:active {
    cursor: grabbing;
}

.tree-generation {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: nowrap;
    position: relative;
}

/* Tree SVG Connections */
.tree-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.tree-connection {
    stroke: rgba(212, 175, 55, 0.6);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
}

/* Member Card */
.member-card {
    background: linear-gradient(135deg, rgba(42, 107, 107, 0.85) 0%, rgba(31, 79, 79, 0.9) 50%, rgba(15, 50, 50, 0.95) 100%);
    border: 2px solid rgba(212, 175, 55, 0.6);
    border-radius: 12px;
    padding: 12px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: auto;
    min-width: 116px;
    height: 220px;
    flex-shrink: 0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.member-card--mountain {
    width: 170px;
    min-width: 170px;
    height: 170px;
    border-radius: 14px;
    padding: 12px;
}

.member-card-content--mountain {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-main--mountain {
    width: 100%;
    height: 100%;
    padding: 8px;
    position: relative;
}

.member-name-center-wrap {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.member-name-horizontal {
    width: 100%;
    text-align: center;
    color: #f2d38a;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 1px;
    word-break: break-all;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 10px rgba(212, 175, 55, 0.25);
}

.member-card:hover {
    border-color: #d4af37;
    box-shadow: 0 12px 40px rgba(212, 175, 55, 0.3);
    z-index: 10;
}

.member-card.selected {
    border-color: #d4af37;
    box-shadow: 0 12px 50px rgba(212, 175, 55, 0.4);
}

.member-card-content {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.member-main,
.member-spouse {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-width: 64px;
    flex-shrink: 0;
    flex: 1;
    height: 100%;
    padding: 12px 0;
}

.member-avatar {
    display: none !important;
}

.member-name-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    font-weight: 700;
    font-size: 1.125rem;
    color: #d4af37;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

.member-card .member-name-vertical {
    max-height: 128px;
    min-height: 128px;
    overflow: hidden;
}
.member-name-vertical span {
    display: block;
}


.member-rank-horizontal {
    font-size: 0.75rem;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    display: inline-block;
    font-weight: 500;
    flex-shrink: 0;
}

.member-rank-fixed {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    margin: 0;
    max-width: calc(100% - 12px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}

.member-dates {
    font-size: 0.625rem;
    color: rgba(212, 175, 55, 0.7);
    font-weight: 500;
    flex-shrink: 0;
}

/* Spouse Section */
.spouse-divider {
    width: 1px;
    height: 160px;
    background: rgba(212, 175, 55, 0.3);
    margin: 0 8px;
    align-self: center;
}

/* Cone View */
.tree-cone-container {
    width: 100%;
    height: 100%;
    perspective: 2000px;
    perspective-origin: center 40%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tree-cone-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(42, 107, 107, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    font-size: 0.75rem;
    color: #d4af37;
}

/* Tree Form Modal */
.tree-form-modal {
    background: linear-gradient(135deg, rgba(163, 141, 75, 0.92) 0%, rgba(121, 103, 48, 0.95) 50%, rgba(47, 37, 19, 0.98) 100%);
    border: 2px solid #d4af37;
}

.tree-form-header {
    background: transparent;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.tree-form-header h2 {
    color: #d4af37;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* Member Manage Modal */
.tree-manage-modal {
    background: linear-gradient(135deg, rgba(163, 141, 75, 0.92) 0%, rgba(121, 103, 48, 0.95) 50%, rgba(47, 37, 19, 0.98) 100%);
    border: 2px solid #d4af37;
    max-height: 80vh;
}

.manage-toolbar {
    display: flex;
    gap: 8px;
}

/* Manage Panel Content */
.manage-mode-tip {
    margin-bottom: 12px;
    color: rgba(255, 236, 186, 0.9);
    font-size: 0.85rem;
}

.manage-member-card {
    background: linear-gradient(135deg, rgba(163, 141, 75, 0.86) 0%, rgba(121, 103, 48, 0.9) 50%, rgba(47, 37, 19, 0.96) 100%);
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.manage-member-card--detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.manage-member-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.manage-member-name {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 800;
    color: #ffe8b0;
    line-height: 1.2;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    word-break: break-all;
}

.manage-gender-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    padding: 0 10px;
    border: 1px solid rgba(212, 175, 55, 0.55);
    background: rgba(0, 0, 0, 0.24);
    color: #f6d88e;
    font-size: 0.95rem;
    font-weight: 700;
}

.manage-member-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.manage-meta-item {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: rgba(0, 0, 0, 0.2);
    color: #f1d087;
    font-size: 0.8rem;
}

.manage-member-card .member-rank-horizontal {
    font-size: 0.875rem;
}

.manage-member-card .member-dates {
    font-size: 0.75rem;
}

.member-deeds-box {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8125rem;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}

.member-deeds-box--detail {
    margin-top: 0;
    font-size: 0.9rem;
    line-height: 1.7;
    border-color: rgba(212, 175, 55, 0.45);
    background: rgba(0, 0, 0, 0.28);
}

.member-deeds-box strong {
    color: #d4af37;
}

/* Children List */
.manage-children {
    margin-top: 20px;
}

.manage-children h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #d4af37;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.child-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(42, 107, 107, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.child-card:hover {
    border-color: #d4af37;
    background: rgba(42, 107, 107, 0.7);
}

.child-card .member-name-vertical {
    font-size: 1rem;
    flex-direction: row;
    gap: 2px;
}

.child-card .member-info {
    flex: 1;
}

.child-member-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffe1a0;
    line-height: 1.25;
}

.child-member-rank {
    margin-top: 6px;
    font-size: 0.75rem;
}

.child-card-arrow {
    color: rgba(212, 175, 55, 0.8);
    font-size: 1.2rem;
    line-height: 1;
    padding-left: 8px;
}

.child-card .member-dates {
    font-size: 0.75rem;
}

/* Spouse Management */
.manage-spouses {
    margin-top: 20px;
}

.manage-spouses h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #d4af37;
    margin-bottom: 12px;
}

.spouse-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(42, 107, 107, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    margin-bottom: 8px;
}

.spouse-item:hover {
    border-color: #d4af37;
}

.spouse-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spouse-info .member-name-vertical {
    font-size: 1rem;
}

.spouse-actions {
    display: flex;
    gap: 4px;
}

.spouse-actions .btn-tree {
    padding: 6px;
}

/* Tree Logo */
.tree-logo-img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
    object-fit: cover;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content.modal-fullscreen {
        height: 95vh;
    }
    
    .tree-toolbar {
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .btn-tree {
        padding: 8px;
    }

    #toggleEditModeBtn {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .spouse-item {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .spouse-info {
        width: 100%;
    }

    .spouse-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   竖屏香炉宽度 — 最终覆盖（放在文件末尾，层叠最后）
   原因说明：
   1) index.html 曾长期用 ?v=20250309v1，浏览器/CDN 会整文件缓存，改 styles.css 也不生效 → 已要求改 v。
   2) 基础 .incense-group 是 380px 固定宽；只有 @media (orientation: portrait) 里覆盖才生效。
      若在横屏/宽>高下调试，orientation 不是 portrait，会始终看到 380px，属正常。
   3) 用 .scene-footer > .incense-group 提高优先级，避免被前面大块 portrait 里其它规则干扰。
   ===================================================================== */
@media (orientation: portrait) {
  .scene-footer > .incense-group {
    width: clamp(200px, 62vw, 320px) !important;
    max-width: none !important;
    min-width: 200px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 260 / 192;
    margin-top: calc(-1 * clamp(200px, 62vw, 320px) * 128 / 260 - 92px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    box-sizing: border-box !important;
  }
  .scene-footer > .worship-btn-row.has-incense {
    gap: calc(clamp(200px, 62vw, 320px) + 40px) !important;
  }
}

/* 旧氏系图位置改为装饰图（禁用点击） */
.genealogy-entry {
  pointer-events: none !important;
  opacity: 1 !important;
}

.genealogy-entry .genealogy-tooltip {
  display: none !important;
}

/* 山海图立方体入口：背景图组内置底居中 */
.mountain-cube-entry {
  position: absolute;
  left: 50%;
  bottom: 2.4%;
  transform: translateX(-50%);
  width: clamp(92px, 11vw, 150px);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10020;
  pointer-events: auto !important;
  touch-action: manipulation;
  line-height: 0;
  display: block;
  clip-path: polygon(32.5% 24.2%, 67.5% 24.2%, 74.2% 32.5%, 74.2% 82.5%, 25.8% 82.5%, 25.8% 32.5%);
  filter: none;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.mountain-cube-svg {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.94;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 210, 120, 0.42)) drop-shadow(0 0 20px rgba(184, 105, 42, 0.24)) brightness(1.22) saturate(1.18) contrast(1.2);
}

.mountain-cube-svg * {
  pointer-events: none;
}

.mountain-cube-entry:hover {
  transform: translateX(-50%) translateY(-1px) scale(1.02);
  filter: drop-shadow(0 0 14px rgba(255, 182, 76, 0.44));
}

.mountain-cube-entry:active {
  transform: translateX(-50%) scale(0.988);
}

@media (orientation: portrait) {
  .mountain-cube-entry {
    bottom: 0;
    width: clamp(96px, 27vw, 138px);
  }
}

@media (orientation: landscape) {
  .mountain-cube-entry {
    bottom: 2.2%;
    width: clamp(192px, 20vw, 292px);
  }
}

@media (orientation: landscape) and (max-aspect-ratio: 4/3) {
  .mountain-cube-entry {
    bottom: 2.6%;
    width: clamp(220px, 23vw, 312px);
  }
}

/* 氏系装饰图：仅横屏/中间尺寸置顶并缩小一半（不影响竖屏） */
@media (orientation: landscape) {
  .genealogy-entry--landscape {
    top: 0 !important;
  }
  .genealogy-entry--landscape img {
    width: clamp(43px, 6vw, 70px) !important;
    min-width: 43px !important;
    min-height: 43px !important;
    height: auto !important;
  }
}

@media (orientation: landscape) and (max-aspect-ratio: 4/3) {
  .genealogy-entry--portrait {
    display: block !important;
    position: absolute !important;
    top: calc(110px / 2) !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10002 !important;
  }
  .genealogy-entry--portrait img {
    width: clamp(53px, 7.2vw, 86px) !important;
    min-width: 53px !important;
    min-height: 53px !important;
    height: auto !important;
  }
}

/* ================= 山海图主题重塑（基于示例元素） ================= */
#familyTreeModal .tree-modal-content {
  --sh-bg-primary: #f6ecd3;
  --sh-color-primary: #8e6a2f;
  --sh-color-secondary: #b78a3d;
  --sh-color-accent: #d4a574;
  --sh-gradient-1: linear-gradient(to bottom, #7f5b27, #b78a3d);
  --sh-gradient-2: linear-gradient(to right, #7f5b27, #b78a3d);
  --sh-gradient-3: linear-gradient(135deg, #c79a4b, #8a642b);

  background:
    radial-gradient(circle at 30% 8%, rgba(255, 246, 222, 0.62) 0%, rgba(255, 246, 222, 0) 40%),
    radial-gradient(circle at 78% 12%, rgba(199, 154, 75, 0.2) 0%, rgba(199, 154, 75, 0) 52%),
    var(--sh-bg-primary);
  border: 1px solid rgba(143, 106, 47, 0.24);
  box-shadow: 0 18px 38px rgba(57, 38, 11, 0.2);
}

#familyTreeModal .tree-modal-content::before {
  background: none;
  opacity: 0;
}

#familyTreeModal .tree-modal-header,
#familyTreeModal .tree-modal-footer {
  background: var(--sh-gradient-1);
  border-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
}

#familyTreeModal .tree-title h2 {
  color: #f7e6bf;
  text-shadow: 0 2px 10px rgba(38, 24, 4, 0.42);
}

#familyTreeModal .tree-hint,
#familyTreeModal .zoom-text {
  color: #f3e0b6;
  text-shadow: 0 2px 10px rgba(38, 24, 4, 0.4);
}

#familyTreeModal .tree-logo {
  background: linear-gradient(145deg, #d8b16a 0%, #b3853a 56%, #7f5b27 100%);
  color: #f7e6bf;
  box-shadow: 0 8px 22px rgba(99, 66, 18, 0.34);
}

/* 按钮：引用示例 .btn 的交互质感 */
#familyTreeModal .btn-tree {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(212, 165, 116, 0.68);
  color: #f8e8c3;
  background: rgba(110, 76, 28, 0.94);
  text-shadow: 0 1px 2px rgba(35, 22, 4, 0.45);
  box-shadow: none;
  transition: none;
}

#familyTreeModal .btn-tree::after {
  display: none;
}

#familyTreeModal .btn-tree:hover {
  transform: none;
  box-shadow: none;
}

#familyTreeModal .btn-tree > * {
  position: relative;
  z-index: 1;
}

#familyTreeModal .btn-tree.btn-close,
#familyTreeModal .btn-tree.btn-danger {
  background: rgba(108, 76, 30, 0.92);
  border-color: rgba(212, 165, 116, 0.62);
  color: #f2d9a3;
  box-shadow: none;
}

.tree-form-modal .btn:hover,
.tree-manage-modal .btn:hover,
.tree-form-modal .btn-tree:hover,
.tree-manage-modal .btn-tree:hover {
  transform: none !important;
  filter: none !important;
}

#familyTreeModal .btn-tree.is-active,
#familyTreeModal .btn-tree.active {
  background: rgba(143, 106, 47, 0.38);
  color: #f8e8c3;
  border-color: rgba(235, 196, 124, 0.8);
  box-shadow: none;
}

#familyTreeModal .tree-modal-body {
  background:
    radial-gradient(circle at 24% 0%, rgba(212, 165, 116, 0.2) 0%, rgba(212, 165, 116, 0) 48%),
    radial-gradient(circle at 78% 12%, rgba(183, 138, 61, 0.22) 0%, rgba(183, 138, 61, 0) 54%),
    var(--sh-bg-primary);
  position: relative;
  overflow: auto;
}

#familyTreeModal .tree-modal-body::before,
#familyTreeModal .tree-modal-body::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* 山纹：直接引入山形线条（示例背景元素） */
#familyTreeModal .tree-modal-body::before {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 320' preserveAspectRatio='none'%3E%3Cpath d='M0 180 L120 130 L220 165 L330 95 L460 155 L600 82 L740 150 L860 108 L980 168 L1120 128 L1200 158' fill='none' stroke='%23d4a574' stroke-opacity='0.65' stroke-width='1.7'/%3E%3Cpath d='M0 210 L110 168 L210 202 L328 132 L458 188 L598 120 L738 182 L862 142 L986 202 L1116 168 L1200 192' fill='none' stroke='%23d4a574' stroke-opacity='0.45' stroke-width='1.35'/%3E%3C/svg%3E"),
    repeating-linear-gradient(156deg, rgba(212, 165, 116, 0.16) 0 1px, transparent 1px 18px);
  background-repeat: no-repeat, repeat;
  background-size: 100% 60%, auto;
  background-position: left top, left top;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.16) 64%, transparent);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.16) 64%, transparent);
  opacity: 0.58;
}

/* 海纹 + 波浪：直接引入示例 wave-decoration 形态 */
#familyTreeModal .tree-modal-body::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cpath d='M0 50 Q 300 20 600 50 T 1200 50 L1200 100 L0 100 Z' fill='%23e2c07a' fill-opacity='0.55'/%3E%3Cpath d='M0 60 Q 250 35 500 60 T 1000 60 T 1200 60 L1200 100 L0 100 Z' fill='%23c79a4b' fill-opacity='0.5'/%3E%3C/svg%3E"),
    repeating-linear-gradient(8deg, rgba(199, 154, 75, 0.2) 0 1px, transparent 1px 14px);
  background-repeat: no-repeat, repeat;
  background-size: 100% 190px, auto;
  background-position: left bottom, left top;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.96), rgba(0, 0, 0, 0.14) 62%, transparent);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.96), rgba(0, 0, 0, 0.14) 62%, transparent);
  opacity: 0.5;
}

#familyTreeModal .tree-container {
  border-radius: 18px;
  position: relative;
  z-index: 1;
}

#familyTreeModal .tree-connection {
  stroke: #d4a574;
  stroke-width: 3.4;
  filter: none;
}

/* 卡片：采用示例“主题数量5”卡片风格（card-stat） */
#familyTreeModal .member-card {
  background: var(--sh-gradient-3);
  border: none;
  color: #f2d9a3;
  box-shadow: 0 12px 30px rgba(88, 58, 15, 0.36);
}

#familyTreeModal .member-card::before {
  content: '✦';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.2);
  line-height: 1;
  pointer-events: none;
}

#familyTreeModal .member-card:hover,
#familyTreeModal .member-card.selected {
  box-shadow: 0 16px 34px rgba(111, 76, 23, 0.4), 0 0 0 1px rgba(236, 203, 131, 0.32);
}

#familyTreeModal .member-name-horizontal {
  color: #f9eacc;
  text-shadow: 0 3px 12px rgba(31, 19, 3, 0.46);
}

#familyTreeModal .member-rank-horizontal {
  color: #f6e4bc;
  border-color: rgba(232, 191, 118, 0.5);
  background: rgba(114, 79, 30, 0.42);
}

#familyTreeModal .tree-cone-hint,
#familyTreeModal .cone-hint {
  background: linear-gradient(135deg, rgba(146, 106, 45, 0.92) 0%, rgba(112, 78, 31, 0.95) 100%);
  border-color: rgba(230, 194, 120, 0.52);
  color: #f0d7a0;
}

#familyTreeModal .btn-hint {
  background: rgba(110, 76, 28, 0.94);
  border: 1px solid rgba(220, 178, 104, 0.72);
  color: #f8e8c3;
  text-shadow: 0 1px 2px rgba(35, 22, 4, 0.45);
  box-shadow: none;
}

#familyTreeModal .btn-hint:hover {
  filter: none;
  transform: none;
}

.tree-form-modal,
.tree-manage-modal {
  background: linear-gradient(135deg, #c79a4b, #7f5b27);
  border: none;
  box-shadow: 0 16px 40px rgba(70, 47, 12, 0.45);
  color: #f2d9a3;
}

.tree-form-header {
  border-bottom: 1px solid rgba(212, 165, 116, 0.35);
}

.tree-form-header h2,
.manage-children h4 {
  color: #f8e7c0;
}

.manage-member-card {
  border: none;
  background: linear-gradient(135deg, #bf8f42, #7a5625);
}

.manage-member-name {
  color: #f8e7c0;
  text-shadow: 0 4px 12px rgba(47, 30, 6, 0.5);
}

.manage-gender-badge,
.manage-meta-item,
.member-deeds-box,
.child-card,
.manage-mode-tip,
.child-member-rank {
  border-color: rgba(231, 193, 120, 0.5);
  background: rgba(101, 69, 24, 0.56);
  color: #f8e7c0;
}

.child-card:hover {
  background: rgba(128, 91, 35, 0.68);
  border-color: rgba(245, 213, 145, 0.76);
}

.child-member-name,
.child-card-arrow {
  color: #f8e7c0;
}

