/* 全局重置 隔离全局污染 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 人物页面需要全局滚动，覆盖 style.css 中禁止 html 滚动的全局规则 */
html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
}

/* body {
    background-color: #f8f6f0;
    color: #2c2c2c;
    font-family: "SimSun", "宋体", serif;
    line-height: 1.75;
    overflow-x: hidden;
} */

ul, li, select, button, input {
    list-style: none;
    font-family: inherit;
}
a {
    text-decoration: none;
    color: inherit;
}
img {
    display: block;
    width: 100%;
    object-fit: cover;
    /* 修复AI图片网页解析模糊 */
    image-rendering: crisp-edges;
}
button {
    cursor: pointer;
    border: none;
}
.hidden {
    display: none !important;
}
.vip-mark {
    color: #c41e3a;
    font-size: 12px;
    background: #fff0f0;
    padding: 2px 6px;
    border-radius: 3px;
}
.lock-text {
    color: #c41e3a;
    font-size: 14px;
    display: block;
    margin-top: 8px;
}
.vip-lock {
    color: #c41e3a;
    text-align: center;
    margin-top: 20px;
}

/* 导航栏 */
.site-nav {
    background: #1a1a1a;
    color: #fff;
}
.nav-wrap {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 62px;
}
.nav-logo {
    font-size: 22px;
    font-weight: bold;
    margin-right: 60px;
}
.nav-list {
    display: flex;
    gap: 40px;
}
.nav-list li a {
    font-size: 16px;
    padding: 8px 0;
    position: relative;
}
.nav-list li.active a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #c41e3a;
}

/* 页面容器通用宽度 */
/* 原 91-95 行：.container —— 减小顶部 padding */
.container {
    width: 1200px;
    margin: 0 auto;
    padding: 20px 0 38px;   /* 上 28，下 50 —— 顶部少 12px，底部加滚动空间 */
}

/* 原 98-114 行：.page-header —— 缩小标题 */
.page-header {
    text-align: center;
    margin-bottom: 24px;    /* 原 40px，少 16px */
}
.page-header h1 {
    font-size: 30px;        /* 原 38px */
    color: #8b2323;
    margin-bottom: 8px;
}
.page-header .sub-title {
    font-size: 14px;
    color: #5a3a10;
    margin-bottom: 4px;
}
.page-header .produce-desc {
    font-size: 12px;
    color: #8a7a60;
}
.page-header .produce-desc p { margin: 2px 0; }

.sub-title {
    font-size: 19px;
    color: #555;
    margin-bottom: 8px;
}
.produce-desc {
    font-size: 14px;
    color: #777;
}

/* 功能快捷入口 */
.function-entrance {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;    /* 原 ~40px，少 20px */
    padding: 8px 0;
    border-bottom: 1px dashed #d4b896;
}
.func-item {
    padding: 6px 14px;
    font-size: 13px;
    background: #fffdf5;
    border: 1px solid #c4a876;
    border-radius: 6px;
    color: #5a3a10;
    cursor: pointer;
    transition: all 0.2s;
}
.func-item:hover { background: #f5ecd8; }
.func-item.active {
    background: #8b2323;
    color: #fff;
    border-color: #8b2323;
}



/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 25px;
}
.filter-item {
    padding: 1px 12px;
    border: 1px solid #c4b89c;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    user-select: none;
}
.filter-item:hover {
    background: #f5ede0;
    color: #8b2323;
    border-color: #8b2323;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(139, 35, 35, 0.18);
}
.filter-item.active {
    background: #8b2323;
    color: #fff;
    border-color: #8b2323;
}

/* 通用模块容器 */
.module-box {
    margin-bottom: 50px;
}
.module-title {
    font-size: 23px;
    color: #8b2323;
    padding-bottom: 5px;
}

/* 人物卡片网格 */
.character-wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 50px 26px;
}
.character-card {
    background: #fff;
    border: 1px solid #8c8d00;
    border-radius: 13px;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    user-select: none;
    position: relative;
}
.character-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 22px rgba(139, 35, 35, 0.18);
}
/* 人物头像容器：用于承载悬浮操作栏的定位参考（允许 tooltip 向上溢出不被裁剪） */
.card-avatar-wrap {
    position: relative;
    height: 290px;
    overflow: visible;
}
.card-avatar {
    width: 100%;
    height: 290px;
    /* 适配750*1000竖版即梦生成人物图 */
    object-fit: cover;
    display: block;
    border-radius: 13px;
}

/* 悬浮操作栏（hover 图片时从右上角显现） */
.card-toolbar {
    position: absolute;
    top: 50%;
    right: -40px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 252, 240, 0.95);
    border: 1px solid #c4a876;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 2;
}

.card-toolbar2 {
    position: absolute;
    top: 50%;
    right: -40px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* gap: 8px; */
    /* padding: 8px; */
    /* background: rgba(255, 252, 240, 0.95); */
    /* border: 1px solid #c4a876; */
    /* border-radius: 12px; */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    /* opacity: 0; */
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    /* z-index: 2; */
}

.character-card:hover .card-toolbar {
    opacity: 1;
    transform: translateY(-50%);
    pointer-events: auto;
}
.card-tool-btn {
    position: relative;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #8b6914;
    cursor: pointer;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    padding: 0;
    z-index: 2;
}
.card-tool-btn:hover {
    background: #8b2323;
    color: #fff;
    transform: scale(1.08);
}
.card-tool-btn.active {
    color: #c41e3a;
}
.card-tool-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: none;
    stroke: currentColor;
}
/* 下载按钮 loading 状态：圆环旋转 */
.card-tool-btn.loading {
    pointer-events: none; /* 下载中禁止重复点击 */
}
.card-tool-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #c4a876;          /* 古铜色外环 */
    border-top-color: #8b2323;          /* 朱红色高亮弧 */
    border-radius: 50%;
    animation: cardSpin 0.8s linear infinite;
    box-sizing: border-box;
    display: block;
}
@keyframes cardSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
/* 全屏查看遮罩内的关闭按钮 */
.expand-close-btn {
    position: fixed;
    top: 5%;
    right: 5%;
    width: 42px;
    height: 42px;
    background: #f8f1e1;
    color: #8b6914;
    border: 2px solid #c4a876;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 0;
    transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.expand-close-btn:hover {
    background: #8b2323;
    color: #fff;
    border-color: #8b2323;
    transform: scale(1.05);
}
/* 悬浮提示气泡（可选，tooltip） */
/* loading 状态下隐藏 tooltip，避免干扰 */
.card-tool-btn.loading[data-tip]::before {
    display: none;
}
.card-tool-btn[data-tip]::before {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.95);
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.card-tool-btn:hover::before {
    opacity: 1;
}
.card-name {
    font-size: 20px;
    text-align: center;
    margin: 12px 0 4px;
    color: #1a1a1a;
}
.card-tag {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    padding: 0 10px;
}

/* 人物分页控件 */
.character-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 30px 0 20px;
    margin-top: 10px;
    flex-wrap: wrap;
    clear: both;
}
.pager-btn {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #c4a876;
    border-radius: 6px;
    font-size: 14px;
    color: #5a3a10;
    cursor: pointer;
    transition: all 0.2s;
}
.pager-btn:hover:not(:disabled) {
    background: #f5ecd8;
    border-color: #8b2323;
    color: #8b2323;
}
.pager-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.pager-info {
    font-size: 14px;
    color: #5a3a10;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}
.pager-total {
    font-size: 12px;
    color: #8a7a60;
    margin-left: 10px;
}

/* 历史场景卡片 */
.scene-wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.scene-card {
    background: #fff;
    border: 1px solid #e0d8c8;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.scene-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 22px rgba(139, 35, 35, 0.18);
    border-color: #c4a876;
}
.scene-img {
    height: 220px;
    width: 100%;
    display: block;
    object-fit: cover;
}
.scene-name {
    text-align: center;
    padding: 10px;
    font-size: 16px;
    color: #5a3a1a;
    transition: color 0.3s ease;
}
.scene-card:hover .scene-name {
    color: #8b2323;
}

/* 双人对比模块 */
.contrast-select {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    justify-content: center;
}
.contrast-select select {
    padding: 8px 12px;
    width: 220px;
    border: 1px solid #c4b89c;
    border-radius: 4px;
}
.contrast-btn {
    padding: 8px 24px;
    background: #8b2323;
    color: #fff;
    border-radius: 4px;
}
.contrast-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.contrast-table-wrap td, .contrast-table-wrap th {
    border: 1px solid #e0d8c8;
    padding: 14px;
    text-align: center;
}
.contrast-table-wrap th {
    background: #f3ede0;
}

/* 关系图谱 */
.map-select {
    margin-bottom: 20px;
}
.map-select select {
    padding: 8px 12px;
    width: 300px;
    border: 1px solid #c4b89c;
}
.map-box {
    width: 100%;
    height: 450px;
    background: #fff;
    border: 1px solid #e0d8c8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#mapImg {
    max-height: 380px;
    width: auto;
}

/* 每日名言卡片 */
.quote-card {
    width: 520px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border: 1px solid #e0d8c8;
    border-radius: 6px;
    text-align: center;
}
#quoteImg {
    height: 320px;
    margin: 0 auto 16px;
    width: auto;
}
.quote-original {
    font-size: 18px;
    font-weight: bold;
    color: #8b2323;
    margin-bottom: 8px;
}
.share-btn {
    margin-top: 14px;
    padding: 8px 22px;
    background: #8b2323;
    color: #fff;
    border-radius: 4px;
}

/* AI问答模块 */
/* ========== AI人物对话问答模块（放大80% + 美化排版） ========== */
.chat-box {
    /* 原700px × 1.8 = 1260px */
    width: 1260px;
    max-width: 92vw;
    margin: 0 auto;
    background: #fffdf5;
    border: 1px solid #d4b896;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(139, 88, 30, 0.12);
    overflow: hidden;
}

/* 顶部人物选择区 */
.chat-character-select {
    padding: 14px 20px;
    border-bottom: 1px solid #e8d9c0;
    background: linear-gradient(to bottom, #f8f1e1 0%, #fffdf5 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #5a3a10;
}

.chat-character-select label {
    font-weight: bold;
    color: #8b2323;
}

.chat-character-select select {
    padding: 6px 12px;
    border: 1px solid #c4a876;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #3a2410;
    min-width: 140px;
}

/* 聊天内容区（放大80%） */
.chat-content {
    height: 576px;   /* 原320px × 1.8 */
    padding: 20px 24px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #fffdf5 0%, #faf5e7 100%);
    scroll-behavior: smooth;
}

/* 滚动条美化 */
.chat-content::-webkit-scrollbar {
    width: 8px;
}
.chat-content::-webkit-scrollbar-track {
    background: #f0e6d3;
    border-radius: 4px;
}
.chat-content::-webkit-scrollbar-thumb {
    background: #c4a876;
    border-radius: 4px;
}
.chat-content::-webkit-scrollbar-thumb:hover {
    background: #a08460;
}

/* 用户消息（右侧气泡） */
.user-chat {
    margin: 14px 0 14px auto;
    max-width: 82%;
    text-align: right;
}

.user-chat .chat-bubble {
    display: inline-block;
    background: linear-gradient(135deg, #8b2323 0%, #a03030 100%);
    color: #fff;
    padding: 12px 18px;
    border-radius: 14px 14px 4px 14px;
    font-size: 15px;
    line-height: 1.8;
    text-align: left;
    box-shadow: 0 2px 8px rgba(139, 35, 35, 0.2);
    word-break: break-word;
}

.user-chat .chat-label {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    background: #fff3d9;
    color: #8b5a00;
    border: 1px solid #e0c890;
}

.user-chat .chat-label.vip {
    background: linear-gradient(135deg, #fff3d9 0%, #ffe5b0 100%);
    color: #8b4513;
    border-color: #d4a060;
}

/* AI 回复（左侧气泡） */
/* AI 回复（左侧气泡，带头像） */
.ai-chat {
    margin: 14px auto 14px 0;
    max-width: 82%;
    text-align: left;
    display: flex;           /* 新增：横向布局 */
    align-items: flex-start; /* 新增：顶部对齐 */
    gap: 12px;               /* 新增：头像和气泡间距 */
}

/* 新增：人物头像 */
.ai-chat .chat-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #d4b896;
    box-shadow: 0 2px 6px rgba(139, 88, 30, 0.2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat .chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.ai-chat .chat-avatar .avatar-placeholder {
    font-size: 22px;
    color: #8b2323;
}

/* 气泡和标签容器 */
.ai-chat .chat-body {
    flex: 1;
    min-width: 0;
}

.ai-chat .chat-label {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    background: #f0e6d3;
    color: #8b5a00;
    border: 1px solid #d4b896;
}

.ai-chat .chat-label.vip {
    background: linear-gradient(135deg, #fff0e0 0%, #ffe0c0 100%);
    color: #c41e3a;
    border-color: #e0a060;
}

.ai-chat .chat-bubble {
    display: block;
    background: #fff;
    color: #3a2410;
    padding: 14px 20px;
    border-radius: 6px 14px 14px 14px;  /* 修改：左上角直角 */
    font-size: 15px;
    line-height: 1.9;
    border: 1px solid #e0d0b0;
    box-shadow: 0 2px 8px rgba(139, 88, 30, 0.08);
    word-break: break-word;
}

/* 同步修改思考中的气泡 */
.ai-chat .chat-bubble.thinking {
    color: #888;
    font-style: italic;
}

.ai-chat .chat-bubble {
    display: inline-block;
    background: #fff;
    color: #3a2410;
    padding: 14px 20px;
    border-radius: 14px 14px 14px 4px;
    font-size: 15px;
    line-height: 1.9;
    border: 1px solid #e0d0b0;
    box-shadow: 0 2px 8px rgba(139, 88, 30, 0.08);
    word-break: break-word;
}

.ai-chat .chat-label {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    background: #f0e6d3;
    color: #8b5a00;
    border: 1px solid #d4b896;
}

.ai-chat .chat-label.vip {
    background: linear-gradient(135deg, #fff0e0 0%, #ffe0c0 100%);
    color: #c41e3a;
    border-color: #e0a060;
}

/* 思考中状态 */
.ai-chat .chat-bubble.thinking {
    color: #888;
    font-style: italic;
}

.ai-chat .chat-bubble.thinking::after {
    content: '…';
    animation: dots 1.4s infinite;
}

@keyframes dots {
    0%, 20% { opacity: 0.3; }
    50% { opacity: 0.7; }
    80%, 100% { opacity: 1; }
}

/* 会员引导提示框 */
.vip-hint {
    text-align: center;
    padding: 16px 20px;
    margin: 16px auto;
    max-width: 80%;
    background: linear-gradient(135deg, #fff5e0 0%, #fff0d0 100%);
    border: 1px dashed #d4a060;
    border-radius: 10px;
    font-size: 14px;
    color: #8b5a00;
}

.vip-hint .hint-title {
    font-size: 16px;
    font-weight: bold;
    color: #8b4513;
    margin-bottom: 6px;
}

.vip-hint button {
    margin-top: 10px;
    padding: 8px 24px;
    background: linear-gradient(135deg, #c41e3a 0%, #8b2323 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(139, 35, 35, 0.3);
    transition: transform 0.15s;
}

.vip-hint button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 35, 35, 0.4);
}

/* 底部输入区 */
.chat-input-area {
    padding: 18px 20px;
    border-top: 1px solid #e8d9c0;
    background: #fffdf5;
}

.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.chat-input-row input[type="text"] {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid #c4a876;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    color: #3a2410;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-row input[type="text"]:focus {
    border-color: #8b2323;
    box-shadow: 0 0 0 3px rgba(139, 35, 35, 0.12);
}

#sendChat {
    padding: 14px 28px;
    background: linear-gradient(135deg, #8b2323 0%, #a03030 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(139, 35, 35, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}

#sendChat:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 35, 35, 0.35);
}

#sendChat:active {
    transform: translateY(0);
}

/* 推荐问题 */
.chat-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.chat-quick-questions .quick-q {
    padding: 6px 14px;
    background: #f8f1e1;
    border: 1px solid #d4b896;
    border-radius: 16px;
    font-size: 13px;
    color: #5a3a10;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-quick-questions .quick-q:hover {
    background: #ede0c8;
    border-color: #c4a876;
    transform: translateY(-1px);
}

/* 底部会员解锁提示 */
.chat-footer-hint {
    text-align: center;
    /* padding: 10px; */
    font-size: 13px;
    color: #8b2323;
    background: #fff8f0;
    border-top: 1px solid #f0e6d3;
}

/* ========== 性格测试模块（保持协调） ========== */
.test-box {
    width: 1000px;   /* 同样适当放大 */
    max-width: 90vw;
    margin: 30px auto;
    background: #fffdf5;
    padding: 36px;
    border: 1px solid #d4b896;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(139, 88, 30, 0.1);
}
.test-question {
    font-size: 22px;
    margin-bottom: 24px;
    color: #3a2410;
    font-weight: bold;
}
.test-option div {
    padding: 14px 20px;
    border: 1px solid #d4b896;
    margin-bottom: 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 15px;
    color: #5a3a10;
}
.test-option div:hover {
    background: #f3ede0;
    border-color: #c4a876;
    transform: translateX(4px);
}


/* ====================== 弹窗核心修复代码 ====================== */
/* 遮罩层 */
.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.2);
    z-index: 1005;
    display: none;
    /* iOS 修复：确保遮罩可接收触摸事件 */
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}
/* 弹窗外层容器：扩大整体范围，覆盖更大部分可视区域，添加古典边框 */
.detail-modal {
    position: fixed;
    top: 53%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    width: 88vw;
    max-width: 1418px;
    height: 88vh;
    max-height: 936px;
    background: #f8f1e1;
    z-index: 1005;
    border-radius: 3px;
    display: none;
    overflow: hidden;
    border: 1px solid #c4a876;
    box-shadow: 0 0 0 8px #f8f1e1, 0 0 0 10px #d4b896, 0 20px 60px rgba(0,0,0,0.5);
    /* iOS 修复：确保 transform 渲染正确 */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
/* 【BUG修复1】关闭按钮提升最高层级，不会被图片遮挡 */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 26px;
    background: rgba(255, 255, 255, 0.9);
    color: #553909;
    z-index: 1001;
    border-radius: 50%;
    border: 1px solid #d4b896;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* iOS 修复：确保可点击 */
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.modal-close:hover {
    background: #f7f0de;
    color:#771010;
}
/* 弹窗内部弹性布局 */
.modal-inner {
    display: flex;
    height: 100%;
    padding-top: 0;
    background: #faf4e4;
}
/* 左侧人物图：固定宽度，高度自适应 */
.modal-left {
    width: 34%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-right: 1px solid #d4b896;
    position: relative;
    overflow: hidden;
}
/* 弹窗左侧立绘图片容器 */
.modal-avatar-wrap {
    position: relative;
    width: 100%;
    max-width: 380px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 人物立绘加载占位符 */
.modal-avatar-wrap {
    position: relative;
}
.avatar-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f5e6c8 0%, #e8d4a8 50%, #d4b896 100%);
    color: #8b6914;
    font-size: 14px;
    z-index: 2;
    transition: opacity 0.3s ease;
}
.avatar-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}
.placeholder-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 105, 20, 0.2);
    border-top-color: #8b6914;
    border-radius: 50%;
    animation: placeholder-spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes placeholder-spin {
    to { transform: rotate(360deg); }
}
.placeholder-text {
    letter-spacing: 0.1em;
}

#characterModalAvatar {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#characterModalAvatar.loaded {
    opacity: 1;
}

/* 弹窗立绘区操作栏：默认常显，定位在左侧区域顶部 */
.modal-toolbar {
    position: absolute;
    top: 32px;
    right: 16px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: rgba(255, 252, 240, 0.96);
}
/* 下载高清人物卡片按钮：紧贴人物图片正下方，居中显示 */
.download-card {
    margin-top: 10px;
    padding: 6px 14px;
    background: #000e01;
    border: 1px solid #d4b896;
    border-radius: 4px;
    color: #ffdcce;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.download-card:hover {
    background: #8b2323;
    color: #fff;
    border-color: #8b2323;
}
/* 右侧文字区域：添加古典宣纸/竹简风格背景，淡雅耐看 */
.modal-right {
    width: 66%;
    padding: 40px 50px 40px 40px;
    overflow-y: auto;
    height: 100%;
    /* 古典宣纸风格：淡雅米黄底色 + 暗纹网格 */
    background-color: #faf4e4;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            rgba(196, 168, 118, 0.06) 40px,
            rgba(196, 168, 118, 0.06) 41px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            rgba(196, 168, 118, 0.05) 40px,
            rgba(196, 168, 118, 0.05) 41px
        ),
        radial-gradient(ellipse at top left, rgba(212, 184, 150, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(196, 168, 118, 0.12) 0%, transparent 50%);
}
.modal-right h2 {
    font-size: 30px;
    color: #8b2323;
    margin-bottom: 8px;
    /* 人名添加古典印章风格下划线 */
    display: inline-block;
    border-bottom: 2px solid #c4a876;
    padding-bottom: 4px;
}
.modal-tag {
    color: #8b6914;
    margin-bottom: 28px;
    font-size: 15px;
}
.content-block {
    margin-bottom: 24px;
    padding: 14px 16px;
    /* 每个内容块类似竹简卡片：浅色底 + 细边框 */
    background: rgba(255, 252, 240, 0.6);
    border: 1px solid rgba(196, 168, 118, 0.35);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(139, 105, 20, 0.06);
}
.content-block h4 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #6b1a1a;
    border-left: 4px solid #8b2323;
    padding-left: 10px;
}

/* ==================== 古代战争地图模块 ==================== */
/* ========== 古代战争地图合集（压缩版） ========== */

/* 搜索栏 + 翻页 */
.map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #fffdf5;
    border: 1px solid #d4b896;
    border-radius: 6px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}
.map-search-wrap { display: flex; gap: 8px; align-items: center; }
.map-search-input {
    width: 320px;
    padding: 7px 12px;
    border: 1px solid #c4a876;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #3a2410;
    outline: none;
}
.map-search-input:focus { border-color: #8b2323; }
.map-search-btn {
    padding: 7px 18px;
    background: #8b2323;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.map-search-btn:hover { background: #6b1a1a; }
.map-pager { display: flex; align-items: center; gap: 10px; color: #5a3a10; font-size: 13px; }
.map-page-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #c4a876;
    border-radius: 6px;
    font-size: 13px;
    color: #5a3a10;
    cursor: pointer;
}
.map-page-btn:hover:not(:disabled) { background: #f5ecd8; border-color: #8b2323; color: #8b2323; }
.map-page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 网格：3 列 */
.map-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;                  /* 原 26px，缩小间距 */
    padding-bottom: 40px;      /* 底部留白，方便滚到 */
}

/* 卡片 — 关键压缩 */
.map-card {
    background: #fff;
    border: 1px solid #d4b896;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.map-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(139, 88, 30, 0.18);
}

/* 图片区 — 缩小，aspect-ratio 调成更扁的 16:9（之前更方） */
.map-img-wrap {
    position: relative;
    width: 100%;
    /* aspect-ratio: 16 / 9;      关键：16:9 比 16:11 矮 20%，整体高度大大下降 */
    background: #f5ecd8;
    overflow: hidden;
    cursor: zoom-in;
    flex-shrink: 0;
}
.map-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}
.map-card:hover .map-img { transform: scale(1.04); }

/* 悬浮遮罩层 */
.map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(58, 36, 16, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.map-card:hover .map-overlay { opacity: 1; }
.map-view-btn {
    padding: 6px 14px;
    background: rgba(255, 253, 245, 0.95);
    color: #8b2323;
    border: 1px solid #fff;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.map-view-btn:hover { background: #fff; }

/* 信息区 — 压缩高度 */
.map-info {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 76px;        /* 压缩到约 76px */
}
.map-title {
    font-size: 14px;         /* 原 16px */
    font-weight: bold;
    color: #3a2410;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.map-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 2px 0;
}
.map-meta-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f5ecd8;
    color: #8b6914;
    border: 1px solid #d4b896;
    border-radius: 8px;
    font-size: 11px;         /* 更小 */
}
.map-desc {
    font-size: 12px;
    color: #5a3a10;
    line-height: 1.6;
    margin: 2px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 平板适配 */
@media (max-width: 900px) {
    .container { width: 95%; padding: 20px 0; }
    .map-wrap { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .map-search-input { width: 180px; }
    .map-info { min-height: 70px; padding: 8px 12px 10px; }
    .map-title { font-size: 13px; }
    .map-desc { font-size: 11.5px; }
    .chat-box { width: 100%; max-width: 100%; }
    .test-box { width: 100%; max-width: 100%; }
    .character-wrap { grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .card-avatar-wrap { height: 220px; }
    .card-avatar { height: 220px; }
    .scene-wrap { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* 移动端完整适配 */
@media (max-width: 768px) {
    .site-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        padding-top: env(safe-area-inset-top);
    }
    .nav-wrap {
        width: 100%;
        padding: 0 12px;
        justify-content: space-between;
        height: 50px;
        overflow: hidden;
    }
    .nav-logo {
        font-size: 15px;
        margin-right: 0;
        flex-shrink: 0;
    }
    .nav-list {
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 10px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .nav-list::-webkit-scrollbar {
        display: none;
    }
    .nav-list li {
        flex-shrink: 0;
    }
    .nav-list li a {
        font-size: 11px;
        padding: 4px 6px;
        white-space: nowrap;
    }
    .nav-list li.active a::after {
        height: 1px;
    }
    .container {
        width: 100%;
        padding: 10px 12px;
        margin: 0;
        box-sizing: border-box;
        padding-top: calc(env(safe-area-inset-top) + 60px);
    }
    .page-header h1 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    .page-header .sub-title {
        font-size: 11px;
        margin-bottom: 4px;
    }
    .page-header .produce-desc {
        font-size: 10px;
        padding: 0 4px;
    }
    .function-entrance {
        gap: 5px;
        padding: 6px 0;
        margin-bottom: 14px;
    }
    .func-item {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 4px;
    }
    .filter-bar {
        gap: 6px;
        flex-wrap: wrap;
        margin-bottom: 14px;
    }
    .filter-item {
        padding: 3px 8px;
        font-size: 11px;
        border-radius: 3px;
    }
    .character-wrap {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .character-card {
        border-radius: 8px;
    }
    .card-avatar-wrap {
        height: 140px;
    }
    .card-avatar {
        height: 140px;
        border-radius: 8px;
    }
    .card-name {
        font-size: 14px;
        margin: 6px 0 2px;
    }
    .card-tag {
        font-size: 10px;
        margin-bottom: 6px;
        padding: 0 6px;
    }
    .character-pager {
        gap: 10px;
        padding: 25px 0 15px;
        margin-top: 8px;
    }
    .pager-btn {
        padding: 6px 14px;
        font-size: 12px;
    }
    .pager-info {
        font-size: 12px;
    }
    .module-title {
        font-size: 16px;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }
    .scene-wrap {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .scene-img {
        height: 120px;
    }
    .scene-name {
        font-size: 12px;
        padding: 6px;
    }
    .contrast-select {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }
    .contrast-select select {
        width: 100%;
        max-width: 280px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .contrast-btn {
        padding: 6px 18px;
        font-size: 12px;
    }
    .map-box {
        height: 250px;
    }
    .quote-card {
        width: 100%;
        padding: 12px;
    }
    #quoteImg {
        height: 160px;
    }
    .quote-original {
        font-size: 14px;
    }
    .chat-box {
        width: 100%;
        max-width: 100%;
        border-radius: 8px;
    }
    .chat-content {
        height: 350px;
        padding: 12px;
    }
    .chat-character-select {
        padding: 10px 14px;
        font-size: 12px;
    }
    .chat-character-select select {
        font-size: 12px;
        padding: 4px 8px;
    }
    .chat-input-row {
        flex-direction: column;
        gap: 6px;
    }
    .chat-input-row input[type="text"] {
        width: 100%;
        padding: 10px 12px;
        font-size: 13px;
    }
    #sendChat {
        width: 100%;
        padding: 10px;
        font-size: 13px;
    }
    .chat-quick-questions .quick-q {
        padding: 4px 8px;
        font-size: 11px;
    }
    .test-box {
        width: 100%;
        max-width: 100%;
        padding: 16px;
    }
    .test-question {
        font-size: 16px;
    }
    .test-option div {
        padding: 10px 12px;
        font-size: 13px;
    }
    .detail-modal {
        width: 98vw;
        height: 92vh;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 6px;
        border: none;
        box-shadow: 0 0 0 2px #d4b896, 0 20px 60px rgba(0,0,0,0.5);
    }
    .modal-mask {
        padding-top: env(safe-area-inset-top);
    }
    .modal-inner {
        flex-direction: column;
        height: 100%;
    }
    .modal-left {
        width: 100%;
        flex-shrink: 0;
        max-height: 48vh;
        aspect-ratio: 3/4;
        border-right: none;
        border-bottom: 1px solid #d4b896;
        padding: 10px 15px;
        justify-content: center;
        overflow: hidden;
    }
    .modal-avatar-wrap {
        width: 100%;
        max-width: 320px;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    #modalAvatar {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    .download-card {
        margin-bottom: 5px;
        padding: 4px 10px;
        font-size: 12px;
        margin-top: auto;
    }
    .modal-right {
        width: 100%;
        flex: 1;
        min-height: 0;
        padding: 15px;
        font-size: 13px;
        line-height: 1.6;
        overflow-y: auto;
    }
    .modal-right h2 {
        font-size: 20px;
        margin-bottom: 4px;
    }
    .modal-tag {
        font-size: 13px;
        margin-bottom: 16px;
    }
    .content-block {
        padding: 8px 10px;
        margin-bottom: 12px;
    }
    .content-block h4 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    .content-block p {
        font-size: 13px;
        line-height: 1.6;
    }
    .modal-close {
        width: 28px;
        height: 28px;
        line-height: 28px;
        /* text-align: center; */
        font-size: 20px;
        top: 12px;
        right: 10px;
        /* background: rgba(255, 255, 255, 0.9); */
        border: 2px solid #710e0e;
    }
    .card-toolbar {
        opacity: 1;
        transform: translateY(-50%);
        pointer-events: auto;
        top: 50%;
        right: 5px;
        padding: 2px;
        gap: 1px;
        flex-direction: column;
        align-items: center;
        border-radius: 3px;
    }
    .card-tool-btn {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
    .card-tool-btn svg {
        width: 14px;
        height: 14px;
    }
    .contrast-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .contrast-table-wrap table {
        min-width: 600px;
    }
    #mapImg {
        max-width: 100%;
        height: auto;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .nav-logo {
        font-size: 13px;
    }
    .nav-list li a {
        font-size: 10px;
        padding: 3px 5px;
    }
    .container {
        padding: 8px 10px;
        padding-top: calc(env(safe-area-inset-top) + 55px);
    }
    .page-header h1 {
        font-size: 18px;
    }
    .page-header .sub-title {
        font-size: 10px;
    }
    .page-header .produce-desc {
        font-size: 9px;
    }
    .func-item {
        font-size: 10px;
        padding: 3px 7px;
    }
    .filter-item {
        font-size: 10px;
        padding: 2px 7px;
    }
    .character-wrap {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .card-avatar-wrap {
        height: 120px;
    }
    .card-avatar {
        height: 120px;
    }
    .card-name {
        font-size: 13px;
        margin: 5px 0 2px;
    }
    .card-tag {
        font-size: 9px;
        margin-bottom: 5px;
    }
    .module-title {
        font-size: 15px;
    }
    .map-wrap {
        grid-template-columns: 1fr;
        gap: 10px;
        padding-bottom: 20px;
    }
    .map-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .map-search-wrap {
        justify-content: stretch;
    }
    .map-search-input {
        flex: 1;
        width: auto;
        font-size: 12px;
    }
    .map-info {
        min-height: 60px;
        padding: 6px 10px;
    }
    .map-title {
        font-size: 12px;
    }
    .map-desc {
        font-size: 11px;
    }
    .scene-img {
        height: 100px;
    }
    .scene-name {
        font-size: 11px;
        padding: 5px;
    }
    .chat-content {
        height: 280px;
    }
    .test-box {
        padding: 12px;
    }
    .test-question {
        font-size: 15px;
    }
    .test-option div {
        padding: 8px 10px;
        font-size: 12px;
    }
    .detail-modal {
        width: 99vw;
        height: 94vh;
    }
    .modal-left {
        max-height: 42vh;
        aspect-ratio: 3/4;
        padding: 10px;
        overflow: hidden;
    }
    .modal-right {
        flex: 1;
        min-height: 0;
        padding: 12px;
        overflow-y: auto;
    }
    .modal-right h2 {
        font-size: 18px;
    }
    .content-block h4 {
        font-size: 13px;
    }
    .content-block p {
        font-size: 12px;
    }
}

/* ==================== 夜间模式：人物弹框样式 ==================== */
/* 桌面端夜间模式：与移动端保持一致的深色主题 */
.night-mode .detail-modal {
    background: #1a1917 !important;
    border: 1px solid #3a3730 !important;
    box-shadow: 0 0 0 8px #1a1917, 0 0 0 10px #3a3730, 0 20px 60px rgba(0,0,0,0.8) !important;
}

.night-mode .modal-inner {
    background: #1a1917 !important;
}

.night-mode .modal-left {
    border-right: 1px solid #3a3730 !important;
    background: #1a1917 !important;
}

.night-mode .modal-avatar-wrap {
    background: #1a1917 !important;
}

.night-mode .avatar-placeholder {
    background: linear-gradient(180deg, #2a2825 0%, #1a1917 50%, #0d0c0b 100%) !important;
    color: #bbb5a6 !important;
}

.night-mode .placeholder-spinner {
    border: 3px solid rgba(187, 181, 166, 0.2) !important;
    border-top-color: #bbb5a6 !important;
}

.night-mode .download-card {
    background: #2a2825 !important;
    border: 1px solid #5a3a10 !important;
    color: #ffdcce !important;
}

.night-mode .download-card:hover {
    background: #8b2323 !important;
    color: #fff !important;
    border-color: #8b2323 !important;
}

.night-mode .modal-toolbar {
    background: rgba(26, 25, 23, 0.96) !important;
    border: 1px solid #3a3730 !important;
}

/* 右侧内容区 - 夜间模式 */
.night-mode .modal-right {
    background-color: #1a1917 !important;
    background-image: none !important;
}

.night-mode .modal-right h2 {
    color: #ff0000 !important;
    border-bottom: 1px solid #ffffff !important;
}

.night-mode .modal-tag {
    color: #c4a876 !important;
}

/* 内容块 - 夜间模式 */
.night-mode .content-block {
    background: none !important;
    border: 1px solid #3a3730 !important;
    box-shadow: none !important;
}

.night-mode .content-block h4 {
    color: #ffffff !important;
    border-left: 3px solid #ffffff !important;
}

.night-mode .content-block p,
.night-mode .content-block li,
.night-mode .content-block span {
    color: #bbb5a6 !important;
}

/* 关闭按钮 - 夜间模式 */
.night-mode .modal-close {
    background: #2a2825 !important;
    color: #bbb5a6 !important;
    border: 1px solid #5a3a10 !important;
}

.night-mode .modal-close:hover {
    background: #8b2323 !important;
    color: #fff !important;
}

/* VIP标记 - 夜间模式 */
.night-mode .vip-mark {
    color: #000000 !important;
    background: #fff0f0 !important;
}

/* 锁定文字 - 夜间模式 */
.night-mode .lock-text {
    color: #ff0000 !important;
}

/* 弹窗遮罩 - 夜间模式 */
.night-mode .modal-mask {
    background: rgba(0, 0, 0, 0.45) !important;
}

.night-mode .content-block span {
    color: var(--text-primary) !important;
    background: #514c40 !important;
}