
        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        body, html { width: 100%; height: 100%; overflow: hidden; font-family: 'KaiTi', 'STKaiti', '楷体', serif; background-color: #f4ead5; }
        .game-container { position: relative; width: 100%; max-width: 480px; height: 100%; max-height: 850px; margin: 0 auto; background: #f4ead5; overflow: hidden; }
       .screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition: opacity 0.3s, transform 0.3s; background-color: #f4ead5; }
        .hidden { opacity: 0; pointer-events: none; z-index: 1; transform: translateX(100%); }
        .active { opacity: 1; pointer-events: auto; z-index: 5; transform: translateX(0); }
        .top-bar { position: absolute; top: 0; left: 0; width: 100%; padding: 15px; z-index: 100; color: #4e342e; font-size: 13px; font-weight: bold; background: linear-gradient(to bottom, rgba(244, 234, 213, 0.9), transparent); }
.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.top-row > span {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    gap: 4px;
}
        @media (min-width: 500px) {
            .top-row { flex-direction: row; }
            .top-row > span:first-child { display: inline; }
            .top-row > span:last-child { display: inline; }
        }
        @media (max-width: 499px) {
            .top-row { flex-direction: column; gap: 4px; width: 100%; }
            .top-row > span:first-child { display: flex; justify-content: flex-start; align-items: center; gap: 15px; width: auto; }
            .top-row > span:last-child { display: flex; justify-content: flex-start; align-items: center; gap: 10px; width: auto; font-size: 12px; }
        }
/* 手机版：府内 + 府外 顶栏下移并居中 */
@media (max-width: 499px) {
    #outer-map-overlay .top-bar,
    #map-screen .top-bar {
        padding-top: 32px;
    }
    #outer-map-overlay .top-row,
    #map-screen .top-row {
        align-items: center;
        gap: 6px;
    }
    #outer-map-overlay .top-row > span:first-child,
    #outer-map-overlay .top-row > span:last-child,
    #map-screen .top-row > span:first-child,
    #map-screen .top-row > span:last-child {
        justify-content: center;
    }
}
        #intro-screen { background-size: cover; background-position: center; }
        #intro-bg-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
        #intro-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; padding: 0; }
        #intro-content > div:first-child { position: absolute; top: 12%; left: 0; width: 100%; text-align: center; }
        .cover-title { font-size: 48px; text-align: center; font-weight: bold; color: #ffd700; letter-spacing: 12px; margin-bottom: 10px; background: rgba(93, 64, 55, 0.75); padding: 8px 30px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); margin: 0 auto; width: fit-content; }
        .cover-subtitle { font-size: 20px; text-align: center; font-weight: bold; color: #FFD700; letter-spacing: 8px; margin-bottom: 30px; -webkit-text-stroke: 1px rgba(0,0,0,0.6); text-shadow: 1px 1px 3px rgba(0,0,0,0.7); }
        .cover-btn-group { position: absolute; bottom: 8%; left: 0; width: 100%; display: flex; flex-direction: column; gap: 15px; padding: 0 40px; z-index: 3; }
        .cover-btn { width: 100%; padding: 16px 0; border: 2px solid rgba(255,248,220,0.8); border-radius: 30px; font-family: 'KaiTi', 'STKaiti', '楷体', serif; font-size: 18px; font-weight: bold; letter-spacing: 4px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); backdrop-filter: blur(4px); transition: all 0.3s; }
        .cover-btn:active { transform: scale(0.95); }
        .cover-btn-continue { background: rgba(93,64,55,0.9); color: #fff; }
        .cover-btn-new { background: rgba(250,238,215,0.9); color: #4e342e; }
        .cover-season-note { position: absolute; bottom: 3%; left: 0; width: 100%; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,0.6); z-index: 3; }
        #intro-story-screen {
    display: flex;
    flex-direction: column;
    padding: 30px 20px 40px 20px;
    background: linear-gradient(to bottom, #fdf8ec, #f4ead5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
#intro-story-screen > * {
    flex-shrink: 0;
}
#intro-story-screen > :first-child {
    margin-top: auto;
}
#intro-story-screen > :last-child {
    margin-bottom: auto;
}
#intro-scroll-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(93, 64, 55, 0.92);
    color: #fff;
    font-size: 13px;
    padding: 6px 18px;
    border-radius: 15px;
    letter-spacing: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    animation: bounce 1.5s infinite;
    pointer-events: none;
    z-index: 30;
    display: none;
    white-space: nowrap;
}
        .intro-title { font-size: 36px; text-align: center; font-weight: bold; color: #6d4c41; margin-bottom: 10px; letter-spacing: 8px; text-shadow: 2px 2px 0px #e8dcc0; }
        .intro-sub { font-size: 16px; text-align: center; color: #8d6e63; margin-bottom: 30px; border-bottom: 1px solid #d4b483; padding-bottom: 20px; }
        .intro-text { font-size: 18px; line-height: 2; color: #3e2723; background: rgba(255, 255, 255, 0.5); border-radius: 10px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
        .intro-btn { display: block; width: 100%; padding: 18px; margin-bottom: 12px; border: 2px solid #8d6e63; border-radius: 30px; background: #fff; color: #4e342e; font-size: 18px; font-weight: bold; font-family: inherit; cursor: pointer; box-shadow: 0 3px 6px rgba(0,0,0,0.1); }
        .intro-btn:active { transform: scale(0.97); background: #f5f5dc; }
        .start-btn { background: #5d4037; color: #fff; border: none; letter-spacing: 4px; }
        #map-screen { background: #f4ead5; }
        #map-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; max-width: 480px; aspect-ratio: 3 / 4; overflow: hidden; background-size: cover; background-position: center; border: 4px solid #8d6e63; }
        .map-hotspot { position: absolute; width: 45px; height: 45px; border-radius: 50%; background: rgba(212, 180, 131, 0.6); border: 2px dashed rgba(255, 255, 255, 0.8); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); display: flex; justify-content: center; align-items: center; color: #fff; font-size: 20px; cursor: pointer; animation: pulse 2s infinite; }
        @keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 0.8; } }
        #spot-west { top: 68%; left: 77%; } #spot-main { top: 53%; left: 42%; } #spot-mother { top: 33%; left: 16%; } #spot-husband { top: 70%; left: 27%; } #spot-garden { top: 25%; left: 49%; }
        /* 新增：大门热区定位 */
        #spot-door { top: 83%; left: 39%; }
        .global-buttons { position: absolute; bottom: 25px; left: 0; width: 100%; display: flex; justify-content: space-around; padding: 0 15px; z-index: 10; }
        .global-btn { width: 31%; padding: 15px 0; border-radius: 30px; border: 2px solid #d4b483; background: rgba(250, 238, 215, 0.95); color: #4e342e; font-size: 16px; font-weight: bold; font-family: inherit; box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer; }
        .global-btn:active { transform: scale(0.95); }
        .global-btn.disabled { background: #ddd; color: #999; border-color: #ccc; pointer-events: none; cursor: not-allowed; filter: grayscale(100%); }
        .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0); z-index: 50; display: flex; justify-content: flex-end; flex-direction: column; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
        .overlay.active { opacity: 1; pointer-events: auto; }
        .menu-panel { background: rgba(250, 238, 215, 0.98); border: 2px solid #d4b483; border-radius: 25px; margin: 0 auto 25px auto; width: 90%; max-width: 450px; padding: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
/* ===== 沈砚秋档案 · 头部底部固定，中间滚动 ===== */
#shenyanqiu-profile-overlay .background-card {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 裴云卿档案 · 头部底部固定，中间滚动 ===== */
#pei-profile-overlay .background-card {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 裴母档案 · 头部底部固定，中间滚动 ===== */
#pei-mother-profile-overlay .background-card {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 弟弟档案 · 头部底部固定，中间滚动 ===== */
#didi-profile-overlay .background-card {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#didi-profile-overlay .background-card .inner-scroll-area {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding-right: 8px;
}
#didi-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar { width: 5px; }
#didi-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
#didi-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-thumb {
    background: #d4b483;
    border-radius: 3px;
}
#didi-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #8d6e63;
}

#shenyanqiu-profile-overlay .background-card .inner-scroll-area {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding-right: 8px;
}

/* 滚动条美化 */
#shenyanqiu-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar { width: 5px; }
#shenyanqiu-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
#shenyanqiu-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-thumb {
    background: #d4b483;
    border-radius: 3px;
}
#shenyanqiu-profile-overlay .background-card .inner-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #8d6e63;
}
/* ===== 铺子/田产面板 · 局部滚动（头部底部固定） ===== */
#shop-overlay .menu-panel,
#field-overlay .menu-panel {
    max-height: 80vh; /* 面板总高度不超过屏幕的80% */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 面板本身不滚动 */
}

/* 中间滚动区域 */
.inner-scroll-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 5px;
    margin-bottom: 10px;
}

/* 中间滚动条美化 */
.inner-scroll-area::-webkit-scrollbar { width: 5px; }
.inner-scroll-area::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
.inner-scroll-area::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
.inner-scroll-area::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 府外关系 · 滚动条美化 */
#outer-relations-content::-webkit-scrollbar { width: 5px; }
#outer-relations-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#outer-relations-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#outer-relations-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 子女消息中心 · 滚动条美化 */
#couple-message-list::-webkit-scrollbar { 
    width: 5px; 
}
#couple-message-list::-webkit-scrollbar-track { 
    background: transparent; 
    border-radius: 3px; 
}
#couple-message-list::-webkit-scrollbar-thumb { 
    background: #d4b483; 
    border-radius: 3px; 
}
#couple-message-list::-webkit-scrollbar-thumb:hover { 
    background: #8d6e63; 
}
/* 孙辈列表 · 滚动条美化 */
#grandchildren-list::-webkit-scrollbar { 
    width: 5px; 
}
#grandchildren-list::-webkit-scrollbar-track { 
    background: transparent; 
    border-radius: 3px; 
}
#grandchildren-list::-webkit-scrollbar-thumb { 
    background: #d4b483; 
    border-radius: 3px; 
}
#grandchildren-list::-webkit-scrollbar-thumb:hover { 
    background: #8d6e63; 
}
/* ===== 航海线界面滚动条美化 ===== */
#hanghai-scroll-area::-webkit-scrollbar { width: 5px; }
#hanghai-scroll-area::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#hanghai-scroll-area::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#hanghai-scroll-area::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* ===== 远航准备室滚动条美化 ===== */
#supplies-scroll::-webkit-scrollbar {
    width: 5px;
}
#supplies-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
#supplies-scroll::-webkit-scrollbar-thumb {
    background: #d4b483;
    border-radius: 3px;
}
#supplies-scroll::-webkit-scrollbar-thumb:hover {
    background: #8d6e63;
}

/* 私产列表 · 滚动条美化 */
#private-trade-scroll::-webkit-scrollbar { width: 5px; }
#private-trade-scroll::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#private-trade-scroll::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#private-trade-scroll::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
  .menu-title { font-size: 20px; font-weight: bold; color: #4e342e; text-align: center; margin-bottom: 15px; border-bottom: 1px solid #d4b483; padding-bottom: 10px; }
        .menu-item { display: block; width: 100%; margin-bottom: 12px; padding: 12px; border: 1px solid #d4b483; background: #fff; border-radius: 10px; color: #4e342e; font-size: 15px; font-weight: bold; cursor: pointer; text-align: center; }
        .menu-item:active { transform: scale(0.97); }
        .menu-item.locked { background: #ddd; color: #999; border-color: #ccc; cursor: not-allowed; }
        .menu-close { display: block; width: 100%; margin-top: 10px; padding: 12px; background: #5d4037; color: #fff; border-radius: 10px; font-size: 15px; cursor: pointer; }
        .entry-btn { width: 100%; padding: 15px; margin-bottom: 12px; background: linear-gradient(135deg, #e8dcc0, #f4ead5); border: 2px solid #8d6e63; border-radius: 16px; font-size: 18px; font-weight: bold; color: #4e342e; box-shadow: 0 3px 6px rgba(0,0,0,0.2); cursor: pointer; }
        .entry-btn:active { transform: scale(0.95); }
        .entry-btn.locked { background: #ddd; color: #999; border-color: #ccc; cursor: not-allowed; }
        #room-screen, #profile-screen, #husband-screen, #garden-screen, #consort-screen { background: #f4ead5; }
        #room-bg, #profile-bg, #husband-bg, #garden-bg, #consort-bg, #naz-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center top; z-index: 1; }
        .room-dialogue, .profile-dialogue { position: absolute; bottom: 0; left: 0; width: 100%; z-index: 20; background: rgba(250, 238, 215, 0.92); border-top: 2px solid #d4b483; border-radius: 25px 25px 0 0; box-shadow: 0 -5px 15px rgba(0,0,0,0.3); padding: 15px 20px 20px 20px; color: #3e2723; }
        .room-title { font-size: 24px; font-weight: bold; letter-spacing: 2px; margin-bottom: 25px; border-bottom: 1px solid #d4b483; padding-bottom: 10px; }
        .profile-name { font-size: 24px; font-weight: bold; letter-spacing: 2px; margin-bottom: 5px; }
        .profile-identity { font-size: 14px; color: #8d6e63; margin-bottom: 20px; }
        .action-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
        .btn { padding: 14px 0; border: none; border-radius: 25px; font-family: inherit; font-size: 16px; font-weight: bold; color: #4e342e; background: #fff; border: 1px solid #d4b483; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: all 0.2s; }
        .btn:active { transform: scale(0.95); background: #f5f5dc; }
        .btn-back { background: #5d4037; color: #fff; border: none; grid-column: 1 / -1; }
        .data-card { background: rgba(250, 238, 215, 0.98); border: 2px solid #d4b483; border-radius: 20px; padding: 20px; margin: 0 auto 25px auto; width: 90%; max-width: 450px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
        .data-header { display: flex; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #d4b483; padding-bottom: 10px; }
        .data-avatar { font-size: 40px; margin-right: 15px; }
        .data-name { font-size: 24px; font-weight: bold; color: #4e342e; }
        .data-identity { font-size: 14px; color: #8d6e63; }
        .data-row { font-size: 15px; color: #3e2723; margin-bottom: 10px; line-height: 1.8; }
        .data-bar { width: 100%; height: 8px; background: rgba(0,0,0,0.1); border-radius: 4px; margin: 5px 0; overflow: hidden; }
        .data-fill { height: 100%; width: 30%; background: linear-gradient(90deg, #e8a0a0, #d15454); border-radius: 4px; }
        .data-thought { font-size: 15px; color: #3e2723; background: #fdf8ec; border-left: 3px solid #8d6e63; padding: 10px; border-radius: 5px; margin-top: 10px; font-style: italic; }
        .message-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
        .message-overlay.active { opacity: 1; pointer-events: auto; }
        .message-card { background: rgba(250, 238, 215, 0.98); border: 2px solid #d4b483; border-radius: 20px; padding: 20px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
        .message-text { font-size: 16px; line-height: 1.8; color: #3e2723; margin-bottom: 20px; white-space: pre-wrap; }
        .message-btn { width: 100%; padding: 12px; border: none; border-radius: 25px; font-family: inherit; font-size: 16px; font-weight: bold; color: #fff; background: #5d4037; cursor: pointer; }
        .message-btn:active { transform: scale(0.95); }
        .counter-row { display: flex; justify-content: center; align-items: center; gap: 15px; margin: 15px 0; }
        .counter-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #8d6e63; background: #fff; font-size: 20px; font-weight: bold; color: #4e342e; cursor: pointer; display: flex; justify-content: center; align-items: center; }
        .counter-btn:active { background: #f5f5dc; transform: scale(0.9); }
        .counter-num { font-size: 24px; font-weight: bold; color: #4e342e; min-width: 40px; text-align: center; }
        .counter-info { font-size: 14px; color: #8d6e63; margin-bottom: 15px; }
        .scene-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 9999; display: flex; justify-content: flex-end; flex-direction: column; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
        .scene-overlay.active { opacity: 1; pointer-events: auto; }
        .scene-panel { background: rgba(250, 238, 215, 0.98); border-top: 3px solid #8d6e63; border-radius: 25px 25px 0 0; width: 100%; max-width: 480px; margin: 0 auto; padding: 25px 20px 35px 20px; box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3); text-align: center; }
        .scene-panel .message-text { font-size: 16px; line-height: 1.8; color: #3e2723; margin-bottom: 20px; white-space: pre-wrap; }
        .scene-panel .message-btn { width: 100%; padding: 14px; border: none; border-radius: 25px; font-family: inherit; font-size: 16px; font-weight: bold; color: #fff; background: #5d4037; cursor: pointer; }
        .scene-panel .message-btn:active { transform: scale(0.95); }
        .background-card { background: rgba(250, 238, 215, 0.98); border: 2px solid #d4b483; border-radius: 20px; padding: 20px; margin: 0 auto 25px auto; width: 90%; max-width: 450px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
        .background-section { font-size: 14px; color: #3e2723; margin-bottom: 12px; line-height: 1.8; }
        .background-section strong { color: #8d6e63; }
        .background-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
        @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
     
        .outer-map-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; max-width: 480px; aspect-ratio: 3 / 4; overflow: hidden; background-size: cover; background-position: center; border: 4px solid #8d6e63; }
        .outer-map-hotspot { position: absolute; width: 45px; height: 45px; border-radius: 50%; background: rgba(212, 180, 131, 0.6); border: 2px dashed rgba(255, 255, 255, 0.8); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); display: flex; justify-content: center; align-items: center; color: #fff; font-size: 20px; cursor: pointer; animation: pulse 2s infinite; z-index: 10; }
        .outer-map-tag { position: absolute; top: 100%; left: 50%; transform: translate(-50%, -2px); white-space: nowrap; background: rgba(250, 238, 215, 0.9); color: #4e342e; font-size: 11px; padding: 2px 4px; border-radius: 3px; border: 1px solid #d4b483; z-index: 11; }
/* ===== 剧情屏 · 通用模板（所有剧情共用，以后不用再改） ===== */
.story-screen {
    background: #1a0f0a;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}

.story-screen .story-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #1a0f0a;
}

.story-screen .story-dialogue {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    min-height: 42%;
    max-height: 45%;
    background: rgba(44, 26, 18, 0.96);
    border-top: 2px solid #d4b483;
    padding: 18px 22px 20px 22px;
    color: #f4ead5;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.story-screen .story-speaker {
    display: inline-block;
    background: #d4b483;
    color: #3e2723;
    padding: 4px 14px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    align-self: flex-start;
    flex-shrink: 0;
}

.story-screen .story-text {
    font-size: 16px;
    line-height: 1.85;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.story-screen .story-scroll-hint {
    display: none;
    font-size: 12px;
    color: #d4b483;
    text-align: right;
    margin-bottom: 5px;
    animation: bounce 1.5s infinite;
    flex-shrink: 0;
}

.story-screen .story-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.story-screen .story-choices button {
    width: 100%;
    padding: 13px 0;
    border: none;
    border-radius: 25px;
    background: #5d4037;
    color: #f4ead5;
    font-size: 15px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.story-screen .story-choices button:active {
    transform: scale(0.96);
    background: #3e2723;
}

/* 通用滚动条美化 */
.story-screen .story-text::-webkit-scrollbar { width: 4px; }
.story-screen .story-text::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
.story-screen .story-text::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 2px; }
/* 年终总结弹窗 · 滚动条美化 */
#chuxi-summary-text::-webkit-scrollbar { width: 5px; }
#chuxi-summary-text::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#chuxi-summary-text::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#chuxi-summary-text::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 通用弹窗 · 滚动条美化 */
#game-message-text::-webkit-scrollbar { width: 5px; }
#game-message-text::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#game-message-text::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#game-message-text::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 新手攻略 · 滚动条美化 */
#newbie-guide-content::-webkit-scrollbar { width: 5px; }
#newbie-guide-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#newbie-guide-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#newbie-guide-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 存档槽 · 滚动条美化 */
#save-slot-list::-webkit-scrollbar { width: 5px; }
#save-slot-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#save-slot-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#save-slot-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 更新日志 · 滚动条美化 */
#changelog-content::-webkit-scrollbar { width: 5px; }
#changelog-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#changelog-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#changelog-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 引子页面 · 滚动条美化 */
#intro-story-screen::-webkit-scrollbar { width: 5px; }
#intro-story-screen::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#intro-story-screen::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#intro-story-screen::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 汴京见闻 · 滚动条美化 */
#bianjing-news-content::-webkit-scrollbar { width: 5px; }
#bianjing-news-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#bianjing-news-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#bianjing-news-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 家族记事 · 滚动条美化 */
#family-chronicle-content::-webkit-scrollbar { width: 5px; }
#family-chronicle-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#family-chronicle-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#family-chronicle-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 庄子总览 · 滚动条美化 */
#zhuang-overview-content::-webkit-scrollbar { width: 5px; }
#zhuang-overview-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#zhuang-overview-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#zhuang-overview-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 子女属性 · 滚动条美化 */
#child-attr-content::-webkit-scrollbar { width: 5px; }
#child-attr-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#child-attr-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#child-attr-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 名流榜 · 滚动条美化 */
#rich-list-card::-webkit-scrollbar { width: 5px; }
#rich-list-card::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
    margin: 22px 0;   /* ★ 上下各缩 22px，避开卡片圆角 */
}
#rich-list-card::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#rich-list-card::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 沈府家族近况 · 滚动条美化 */
#didi-family-content::-webkit-scrollbar { width: 5px; }
#didi-family-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#didi-family-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#didi-family-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }

/* 乌衣巷列表 · 滚动条美化 */
#wuyixiang-list::-webkit-scrollbar { width: 5px; }
#wuyixiang-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#wuyixiang-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#wuyixiang-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }

/* 嫁妆窗 · 滚动条美化 */
#dowry-scroll::-webkit-scrollbar { width: 5px; }
#dowry-scroll::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#dowry-scroll::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#dowry-scroll::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 聘礼窗 · 滚动条美化 */
#betrothal-scroll::-webkit-scrollbar { width: 5px; }
#betrothal-scroll::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#betrothal-scroll::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#betrothal-scroll::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 子女关系 · 滚动条美化 */
#child-relations-list::-webkit-scrollbar { width: 5px; }
#child-relations-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#child-relations-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#child-relations-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }

/* 孙辈总览 · 滚动条美化（2026-11-06） */
#gc-hub-list::-webkit-scrollbar { width: 5px; }
#gc-hub-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#gc-hub-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#gc-hub-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 排行榜内容区滚动条 */
#rank-panel-content::-webkit-scrollbar { width: 5px; }
#rank-panel-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#rank-panel-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#rank-panel-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 职业选择列表 · 滚动条美化 */
#career-choice-list::-webkit-scrollbar { width: 5px; }
#career-choice-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#career-choice-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#career-choice-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 职业界面滚动区 · 滚动条美化 */
#career-scroll-area::-webkit-scrollbar { width: 5px; }
#career-scroll-area::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#career-scroll-area::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#career-scroll-area::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
/* 音符跳动动画 */
@keyframes bgmPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}
#bgm-toggle.bgm-playing {
    animation: bgmPulse 1s infinite ease-in-out;
}
/* 音量滑条美化 */
#bgm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f4ead5;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
#bgm-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: #f4ead5;
    cursor: pointer;
}
/* ===== 宝物图鉴 · 滚动条美化 ===== */
#ht-content::-webkit-scrollbar { width: 5px; }
#ht-content::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#ht-content::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#ht-content::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
#ht-tabs::-webkit-scrollbar { height: 4px; }
#ht-tabs::-webkit-scrollbar-track { background: transparent; }
#ht-tabs::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 2px; }
/* 宝物图鉴 · 地方标签按钮 */
.ht-tab {
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    color: #4e342e;
    background: #fff;
    border: 1px solid #d4b483;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: center;
    line-height: 1.4;
    transition: all 0.2s;
}
.ht-tab.active {
    background: #5d4037;
    color: #fff;
    border-color: #5d4037;
    font-weight: bold;
}
.ht-tab span {
    display: block;
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}
/* ===== 成就系统 ===== */
#achieve-overlay {
    background: rgba(44, 26, 18, 0.92);
    justify-content: center;
    align-items: center;
    flex-direction: row;
}
.achieve-panel {
    background: linear-gradient(180deg, #fdf8ec 0%, #f4ead5 100%);
    border: 3px solid #8d6e63;
    border-radius: 20px;
    width: 92%;
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    padding: 15px;
    box-sizing: border-box;
}
.achieve-header {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #d4b483;
    flex-shrink: 0;
}
.achieve-title {
    font-size: 20px;
    font-weight: bold;
    color: #4e342e;
    letter-spacing: 2px;
    margin-bottom: 5px;
}
.achieve-progress {
    font-size: 13px;
    color: #8d6e63;
}
.achieve-cats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 10px 0;
    flex-shrink: 0;
}
.achieve-cat {
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    color: #8d6e63;
    background: #fff;
    border: 1px solid #d4b483;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.achieve-cat.active {
    background: linear-gradient(135deg, #8d6e63, #5d4037);
    color: #fff;
    border-color: #5d4037;
}
.achieve-list {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}
.achieve-list::-webkit-scrollbar { width: 4px; }
.achieve-list::-webkit-scrollbar-track { background: transparent; }
.achieve-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 2px; }
.achieve-item {
    background: #fff;
    border: 1px solid #d4b483;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}
.achieve-item.done {
    background: linear-gradient(135deg, #fff8e1, #ffe8b0);
    border: 2px solid #d4af37;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}
.achieve-item.hidden-locked {
    background: #f0ebe0;
    border: 1px dashed #bbb;
    opacity: 0.8;
}
.achieve-item.hidden-done {
    background: linear-gradient(135deg, #fff8e1, #ffe8b0);
    border: 2px solid #d4af37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}
.achieve-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}
.achieve-info {
    flex: 1;
    min-width: 0;
}
.achieve-name {
    font-size: 15px;
    font-weight: bold;
    color: #4e342e;
    margin-bottom: 3px;
}
.achieve-item.done .achieve-name {
    color: #8b6914;
}
.achieve-desc {
    font-size: 12px;
    color: #8d6e63;
    margin-bottom: 4px;
    line-height: 1.4;
}
.achieve-bar {
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}
.achieve-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4b483, #8d6e63);
    border-radius: 3px;
    transition: width 0.3s;
}
.achieve-item.done .achieve-fill {
    background: linear-gradient(90deg, #d4af37, #8b6914);
}
.achieve-status {
    font-size: 11px;
    color: #8d6e63;
}
.achieve-item.done .achieve-status {
    color: #2e7d32;
    font-weight: bold;
}
.achieve-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #d4b483;
    margin-top: 8px;
    flex-shrink: 0;
}
.achieve-page-btn {
    padding: 6px 16px;
    font-family: inherit;
    font-size: 13px;
    color: #4e342e;
    background: #fff;
    border: 1px solid #d4b483;
    border-radius: 15px;
    cursor: pointer;
}
.achieve-page-btn:active { background: #f5f5dc; }
.achieve-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.achieve-page-info {
    font-size: 13px;
    color: #8d6e63;
}
.achieve-close-btn {
    width: 100%;
    padding: 10px;
    background: #5d4037;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    flex-shrink: 0;
}
.achieve-close-btn:active { transform: scale(0.98); }
/* ===== 成就横幅（底部滑出）===== */
#achieve-banner {
    position: fixed;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fff8e1, #ffe8b0);
    border: 2px solid #d4af37;
    border-radius: 25px;
    padding: 10px 28px;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    z-index: 20000;
    transition: top 0.4s ease-out;
    min-width: 220px;
    max-width: 88%;
    box-sizing: border-box;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#achieve-banner.active { top: 70px; }
#achieve-banner-icon {
    font-size: 22px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
#achieve-banner-text {
    font-family: 'KaiTi', 'STKaiti', serif;
    font-size: 14px;
    font-weight: bold;
    color: #8b6914;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.5;
}
/* ===== 平板专属适配（只影响触屏平板，手机和电脑不动）===== */
@media (min-width: 500px) and (max-width: 1400px) and (pointer: coarse) {

    /* 1. 游戏主容器整体放大 */
    .game-container {
        max-width: 680px;
        max-height: 100vh;
    }

    /* 2. 府内 / 府外地图跟着容器一起变宽 */
    #map-frame,
    .outer-map-frame,
    #outer-map-overlay {
        max-width: 680px !important;
        max-height: 100vh !important;
    }

    /* 3. 所有弹窗面板变宽，和游戏容器对齐 */
    .menu-panel,
    .data-card,
    .background-card,
    .message-card,
    .achieve-panel {
        max-width: 620px;
        width: 92%;
    }
    .scene-panel {
        max-width: 680px;
    }

    /* 弹窗往上抬一点，不贴到屏幕最底部 */
    .menu-panel {
        margin-bottom: 45px;
    }

    /* 4. 全屏型亲密剧情也一起变宽 */
    #xie-intimate-overlay,
    #liyuan-intimate-overlay {
        max-width: 680px !important;
    }

    /* 5. 字体和按钮略微放大，避免宽屏下显得空 */
    .top-bar { font-size: 15px; }
    .menu-title { font-size: 22px; }
    .menu-item { font-size: 16px; padding: 14px; }
    .menu-close { font-size: 16px; padding: 14px; }
    .entry-btn { font-size: 19px; padding: 16px; }
    .message-text { font-size: 17px; line-height: 1.9; }
    .global-btn { font-size: 17px; padding: 16px 0; }
    .data-name { font-size: 26px; }
    .data-row { font-size: 16px; }
    .background-section { font-size: 15px; line-height: 2; }
/* 修复：所有非剧情屏的背景图，把底部留白推出容器外 */
.screen:not(.story-screen) > div[id$="-bg"] {
    height: 120% !important;
    background-size: cover !important;
    background-position: center top !important;
}

    /* 序章前两页：在平板上稍微往上抬，第三页保持居中 */
    #intro-story-screen.intro-early > :first-child {
        margin-top: 19vh;
    }
    #intro-story-screen.intro-early > :last-child {
        margin-bottom: 0;
    }
}   /* 平板 CSS 块结尾 */
/* ===== 剧情屏 3 选项高能模式（黄金比例版） ===== */
.story-screen .story-dialogue.tall-mode {
    max-height: 52% !important; /* 拉到 52%，既露字又不挡脸 */
    padding-bottom: 12px !important; /* 底部稍微收紧一点 */
}

/* 顺带把 tall-mode 下的按钮稍微压扁一点点，省点空间 */
.story-screen .story-dialogue.tall-mode .story-choices button {
    padding: 11px 0 !important;
    margin-top: 4px !important;
}


/* ★ 单按钮档案卡整行铺满（2026-11-04，皇后/永昌伯夫人档案等） */
.background-actions .btn:only-child { grid-column: 1 / -1; }

/* 设宴/雅集/马球会 · 选人列表滚动条美化（2026-11-10 顺手补，全游戏滚动条统一） */
#banquet-guest-list::-webkit-scrollbar,
#yaji-guest-list::-webkit-scrollbar,
#polo-guest-list::-webkit-scrollbar { width: 5px; }
#banquet-guest-list::-webkit-scrollbar-track,
#yaji-guest-list::-webkit-scrollbar-track,
#polo-guest-list::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
#banquet-guest-list::-webkit-scrollbar-thumb,
#yaji-guest-list::-webkit-scrollbar-thumb,
#polo-guest-list::-webkit-scrollbar-thumb { background: #d4b483; border-radius: 3px; }
#banquet-guest-list::-webkit-scrollbar-thumb:hover,
#yaji-guest-list::-webkit-scrollbar-thumb:hover,
#polo-guest-list::-webkit-scrollbar-thumb:hover { background: #8d6e63; }
