/* ============================================
   清正廉洁人生模拟器 - 样式表
   设计稿：1000px × 600px，整体等比缩放
   风格：金色RPG游戏风
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #1a0f0a;
    color: #333;
    /* 安全区域适配（刘海屏、折叠屏铰链等） */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}

/* 强制横屏模式：竖屏时将内容旋转90度显示 */
body.force-landscape {
    width: 100vh;
    height: 100vw;
    width: calc(var(--vh, 1vh) * 100);
    height: calc(var(--vw, 1vw) * 100);
    transform: rotate(90deg);
    transform-origin: center center;
    position: fixed;
    top: 50%;
    left: 50%;
    margin-left: calc(-50vh);
    margin-top: calc(-50vw);
    margin-left: calc(var(--vh, 1vh) * -50);
    margin-top: calc(var(--vw, 1vw) * -50);
}

/* ============================================
   游戏容器 - 整体等比缩放
   ============================================ */
#gameContainer {
    width: 1000px;
    height: 600px;
    position: relative;
    transform-origin: center center;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#gameContainer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.35) 0%,
        rgba(0, 0, 0, 0.15) 40%,
        rgba(0, 0, 0, 0.15) 60%,
        rgba(0, 0, 0, 0.45) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* 游戏缩放包裹层 */
.game-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #1a0f0a;
}

/* ============================================
   顶部状态栏
   ============================================ */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(180deg, #2a1a0f 0%, #1a0f0a 100%);
    border-bottom: 2px solid #c9a55a;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.stage-name {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: #ffd700;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.attributes-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.attr-item {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 4px 8px 6px 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(201, 165, 90, 0.4);
    border-radius: 6px;
}

.attr-label {
    color: #c9a55a;
    margin-bottom: 2px;
    font-size: 16px;
    letter-spacing: 1px;
    font-weight: 500;
}

.attr-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.attr-value.honesty { color: #4ade80; }
.attr-value.responsibility { color: #60a5fa; }
.attr-value.rules { color: #c084fc; }
.attr-value.interest { color: #fb923c; }

.attr-bar-bg {
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.attr-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 2px;
}

.attr-bar-fill.honesty { background: #4ade80; }
.attr-bar-fill.responsibility { background: #60a5fa; }
.attr-bar-fill.rules { background: #c084fc; }
.attr-bar-fill.interest { background: #fb923c; }

/* ============================================
   主内容区
   ============================================ */
#mainArea {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

/* ============================================
   开始页面
   ============================================ */
.start-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px 20px;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.game-logo {
    font-size: 64px;
    margin-bottom: 2px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    line-height: 1;
}

.game-title {
    font-family: "STFangsong", "FZKai-Z03", "KaiTi", "STKaiti", "SimSun", serif;
    font-size: 72px;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    background: linear-gradient(
        180deg,
        #fff4b8 0%,
        #ffd86a 25%,
        #f6b928 55%,
        #c98216 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow:
        0 2px 0 #fff1a8,
        0 4px 0 #b56d12,
        0 6px 10px rgba(80, 40, 0, 0.45),
        0 0 20px rgba(255, 210, 80, 0.25);
    margin-bottom: 8px;
    line-height: 1.1;
}

.game-title-sub {
    font-family: "STSong", "STSongti-SC", "SimSun", serif;
    font-size: 34px;
    font-weight: 600;
    letter-spacing: 10px;
    color: #5c4328;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
    padding: 0 50px;
}

.game-title-sub::before,
.game-title-sub::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8b7355, transparent);
    transform: translateY(-50%);
}

.game-title-sub::before { left: 0; }
.game-title-sub::after { right: 0; }

.game-subtitle {
    font-family: "STSong", "SimSun", serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 4px;
    color: #806b50;
    text-align: center;
    margin-bottom: 24px;
}

.start-btn {
    width: 420px;
    height: 82px;
    border: 2px solid #d89a28;
    border-radius: 42px;
    font-family: "STSong", "SimSun", serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 5px;
    color: #fff8dc;
    background: linear-gradient(
        180deg,
        #f9d36b 0%,
        #d99b25 45%,
        #a96813 100%
    );
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.8),
        inset 0 -5px 10px rgba(100, 45, 0, 0.35),
        0 3px 0 #80500d,
        0 8px 20px rgba(70, 40, 0, 0.35),
        0 0 20px rgba(240, 180, 50, 0.25);
    text-shadow: 0 2px 3px rgba(80, 40, 0, 0.7);
    cursor: pointer;
    transition: 0.25s ease;
    margin: 6px 0;
    padding: 0;
    min-width: auto;
    line-height: 82px;
}

.start-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(
        180deg,
        #ffe48b 0%,
        #eab33b 45%,
        #b87818 100%
    );
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.9),
        inset 0 -5px 10px rgba(100, 45, 0, 0.25),
        0 4px 0 #80500d,
        0 10px 25px rgba(120, 70, 0, 0.4),
        0 0 30px rgba(255, 205, 80, 0.45);
}

.start-btn:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.6),
        inset 0 -3px 8px rgba(100, 45, 0, 0.35),
        0 2px 0 #80500d,
        0 4px 10px rgba(70, 40, 0, 0.3);
}

.start-btn-gray {
    width: 350px;
    height: 62px;
    border: 1px solid #777b83;
    border-radius: 32px;
    font-family: "STSong", "SimSun", serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #f0f0f0;
    background: linear-gradient(
        180deg,
        #5e626b 0%,
        #383d46 100%
    );
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.18),
        inset 0 -4px 8px rgba(0, 0, 0, 0.35),
        0 5px 12px rgba(0, 0, 0, 0.35);
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.7);
    cursor: pointer;
    margin: 6px 0;
    padding: 0;
    min-width: auto;
    line-height: 62px;
    transition: 0.2s ease;
}

.start-btn-gray:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.1),
        inset 0 -2px 6px rgba(0, 0, 0, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

.start-btn-gray[disabled] {
    background: linear-gradient(180deg, #555a66 0%, #404550 50%, #353a45 100%);
    color: #888d98;
    border-color: #2a2e38;
    box-shadow: 0 2px 0 #1e222a, 0 3px 6px rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
    opacity: 0.85;
    text-shadow: none;
}

/* 底部图鉴入口 - 古籍面板风格 */
.gallery-entry-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 850px;
    height: 130px;
    background: linear-gradient(
        180deg,
        rgba(34, 38, 45, 0.94),
        rgba(22, 25, 30, 0.96)
    );
    border: 1px solid #b99755;
    box-shadow:
        inset 0 0 0 2px rgba(255, 210, 110, 0.08),
        inset 0 0 30px rgba(0, 0, 0, 0.35),
        0 10px 30px rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    margin-top: 16px;
    padding: 0;
    gap: 0;
    flex-wrap: nowrap;
    position: relative;
}

/* 古籍面板四角装饰 */
.gallery-entry-row::before,
.gallery-entry-row::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #b99755;
    pointer-events: none;
}

.gallery-entry-row::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.gallery-entry-row::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.gallery-entry-btn {
    width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    height: 100%;
    box-shadow: none;
    position: relative;
}

.gallery-entry-btn:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60px;
    background: linear-gradient(180deg, transparent, #b99755, transparent);
}

.gallery-entry-btn:active {
    transform: scale(0.97);
    box-shadow: none;
}

.entry-icon {
    font-size: 36px;
    margin-bottom: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #3d2817 0%, #2a1a0f 100%);
    border: 2px solid #b99755;
    border-radius: 50%;
    flex-shrink: 0;
}

.entry-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.entry-name {
    font-family: "STSong", "SimSun", serif;
    font-size: 18px;
    letter-spacing: 2px;
    color: #e5dcc8;
    font-weight: 500;
    margin-bottom: 0;
}

.entry-count {
    font-size: 24px;
    font-weight: 700;
    color: #f2c45d;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    margin-top: 6px;
}

/* ============================================
   出生选择页面
   ============================================ */
.birth-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

.birth-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 28px;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.birth-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 900px;
}

.birth-card {
    flex: 1;
    min-width: 220px;
    max-width: 280px;
    padding: 14px 14px 18px 14px;
    background: linear-gradient(180deg, #f5e6c8 0%, #e8d4a8 100%);
    border: 2px solid #c9a55a;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    box-shadow: 0 4px 0 #8b6914, 0 6px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.birth-card:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #8b6914, 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* 出生选择视频区域 */
.birth-video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 比例 */
    background: #000;
    border: 2px solid #c9a55a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.birth-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.birth-video-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(135deg, #3d2817 0%, #5c3d1f 50%, #3d2817 100%);
    color: #ffd700;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.birth-video-placeholder-active {
    display: flex;
}

.birth-video-icon {
    font-size: 48px;
    margin-bottom: 6px;
}

.birth-video-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
}

.birth-name {
    font-size: 20px;
    font-weight: 700;
    color: #5c3d00;
    margin-bottom: 4px;
}

.birth-desc {
    font-size: 13px;
    color: #8b6914;
    margin-bottom: 10px;
    line-height: 1.4;
}

.birth-attrs {
    font-size: 13px;
    color: #7a5a2a;
    line-height: 1.8;
    text-align: left;
    padding: 0 8px;
}

.birth-attr-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.birth-attr-row span:last-child {
    font-weight: 600;
    color: #5c3d00;
}

/* ============================================
   事件页面 - 左右布局（左侧视频 + 右侧剧情选项）
   ============================================ */
.event-layout {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    width: 100%;
    gap: 16px;
    align-items: stretch;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}

/* ===== 左侧：视频区域 ===== */
.video-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    box-sizing: border-box;
}

.video-wrapper {
    flex: 1;
    position: relative;
    background: #000;
    border: 3px solid #c9a55a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-height: 0;
}

.event-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

/* 视频加载占位 */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a1a0f 0%, #4a2c17 50%, #1a0f0a 100%);
    color: #ffd700;
    z-index: 2;
}

/* 加载动画圈 */
.video-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    margin-bottom: 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.placeholder-icon {
    font-size: 60px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.placeholder-text {
    font-size: 18px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.placeholder-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 视频上方人物叠加层 */
.video-characters-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
}

.video-character {
    position: absolute;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: characterBounce 0.5s ease;
}

.video-character.char-left {
    left: 16px;
}

.video-character.char-right {
    right: 16px;
}

.video-char-avatar {
    width: 70px;
    height: 90px;
    background: linear-gradient(180deg, #f5e6c8 0%, #e8d4a8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 2px solid #c9a55a;
    border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.video-char-name {
    margin-top: 4px;
    background: linear-gradient(180deg, #2a1a0f 0%, #1a0f0a 100%);
    color: #ffd700;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px solid #c9a55a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

@keyframes characterBounce {
    0% { transform: translateY(15px); opacity: 0; }
    60% { transform: translateY(-3px); }
    100% { transform: translateY(0); opacity: 1; }
}

/* ===== 右侧：剧情 + 选项 ===== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 8px 4px 4px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #c9a55a transparent;
    justify-content: flex-start;
}

.right-panel::-webkit-scrollbar {
    width: 6px;
}

.right-panel::-webkit-scrollbar-track {
    background: transparent;
}

.right-panel::-webkit-scrollbar-thumb {
    background: #c9a55a;
    border-radius: 3px;
}

/* 剧情面板 */
.story-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    z-index: 3;
    margin-top: 8px;
}

.story-content {
    background: linear-gradient(180deg, #faf0d7 0%, #f0e0b8 100%);
    border: 3px solid #c9a55a;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    max-height: none;
    overflow: visible;
}

/* 对话框装饰角 */
.story-content::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 10px;
    width: 20px;
    height: 12px;
    border-top: 2px solid #c9a55a;
    border-left: 2px solid #c9a55a;
    border-radius: 4px 0 0 0;
}

.story-content::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 10px;
    width: 20px;
    height: 12px;
    border-bottom: 2px solid #c9a55a;
    border-right: 2px solid #c9a55a;
    border-radius: 0 0 4px 0;
}

.event-index {
    display: inline-block;
    background: linear-gradient(180deg, #6b4423 0%, #4a2c17 100%);
    color: #ffd700;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    border: 1px solid #c9a55a;
}

.event-title {
    font-size: 22px;
    font-weight: 700;
    color: #5c3d00;
    margin-bottom: 8px;
    line-height: 1.3;
    border-bottom: 1px solid rgba(201, 165, 90, 0.4);
    padding-bottom: 6px;
}

.event-content {
    font-size: 18px;
    color: #4a3010;
    line-height: 1.7;
    text-align: justify;
    font-weight: 400;
}

/* 选项区域 */
.choices-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-height: 0;
    padding: 0;
    margin-top: 10px;
}

.choice-btn {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 12px 16px;
    color: #5c3d00;
    background: linear-gradient(180deg, #ffe066 0%, #ffc93c 50%, #e6a817 100%);
    border: 2px solid #c9a55a;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s ease;
    line-height: 1.5;
    box-shadow: 0 3px 0 #8b6914, 0 4px 8px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px;
}

.choice-btn:last-child {
    margin-bottom: 0;
}

.choice-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #8b6914, 0 2px 4px rgba(0, 0, 0, 0.25);
    background: linear-gradient(180deg, #ffd633 0%, #ffbb00 50%, #d4940f 100%);
}

.choice-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(180deg, #6b4423 0%, #4a2c17 100%);
    color: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    margin-right: 12px;
    border: 1px solid #c9a55a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.choice-text {
    flex: 1;
    line-height: 1.5;
    padding-top: 2px;
}

/* ============================================
   结局页面
   ============================================ */
.ending-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 24px;
    padding-bottom: 20px;
    padding-left: 24px;
    padding-right: 24px;
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    background: linear-gradient(180deg, #faf0d7 0%, #f0e0b8 100%);
    border: 3px solid #c9a55a;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.ending-badge {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    border: 3px solid #fff;
}

.ending-title {
    font-size: 26px;
    font-weight: 700;
    color: #5c3d00;
    margin-bottom: 6px;
    letter-spacing: 2px;
}

.ending-subtitle {
    font-size: 13px;
    color: #8b6914;
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.ending-desc {
    font-size: 14px;
    color: #5c3d00;
    line-height: 1.8;
    max-width: 500px;
    margin-bottom: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 14px 20px;
    border-radius: 10px;
    border: 1px solid rgba(201, 165, 90, 0.4);
}

.ending-attrs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.ending-attr-item {
    text-align: center;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(201, 165, 90, 0.4);
    min-width: 70px;
}

.ending-attr-label {
    font-size: 11px;
    color: #8b6914;
    margin-bottom: 2px;
}

.ending-attr-value {
    font-size: 18px;
    font-weight: 700;
}

/* 结局页 - 人物图鉴入口 */
.ending-gallery-row {
    width: 100%;
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
}

.ending-gallery-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(180deg, #5c3a20 0%, #3d2410 100%);
    border: 2px solid #c9a55a;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.ending-gallery-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ending-gallery-icon {
    font-size: 20px;
}

.ending-gallery-text {
    color: #ffd700;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}

.ending-gallery-count {
    color: #ffd700;
    font-size: 14px;
    font-weight: 700;
    margin-left: 4px;
}

.ending-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 0;
}

.ending-btn {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    color: #5c3d00;
    background: linear-gradient(180deg, #ffe066 0%, #ffc93c 50%, #e6a817 100%);
    border: 2px solid #c9a55a;
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 1px;
    box-shadow: 0 3px 0 #8b6914, 0 4px 8px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ending-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #8b6914, 0 2px 4px rgba(0, 0, 0, 0.25);
}

.ending-btn.ending-btn-secondary {
    background: linear-gradient(180deg, #6a5a4a 0%, #4a3a2a 100%);
    color: #e0c89a;
    border-color: #8b7355;
    box-shadow: 0 3px 0 #2a1a0f, 0 4px 8px rgba(0, 0, 0, 0.3);
    text-shadow: none;
}

.ending-btn.ending-btn-secondary:active {
    box-shadow: 0 1px 0 #2a1a0f, 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   图鉴/成就页面
   ============================================ */
.gallery-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 0;
    background: linear-gradient(180deg, #faf0d7 0%, #f0e0b8 100%);
    border: 3px solid #c9a55a;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 2px solid #c9a55a;
    flex-shrink: 0;
    background: linear-gradient(180deg, #f0e0b8 0%, #e8d4a8 100%);
    border-radius: 13px 13px 0 0;
}

.gallery-back {
    padding: 6px 14px;
    font-size: 13px;
    background: linear-gradient(180deg, #6a5a4a 0%, #4a3a2a 100%);
    color: #e0c89a;
    border: 1px solid #8b7355;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.gallery-back:active {
    transform: translateY(1px);
}

.gallery-title {
    font-size: 18px;
    font-weight: 700;
    color: #5c3d00;
    letter-spacing: 1px;
}

.gallery-count {
    font-size: 13px;
    color: #8b6914;
    font-weight: 600;
}

.gallery-grid {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    align-content: start;
}

.gallery-card {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(201, 165, 90, 0.4);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    transition: all 0.2s ease;
}

.gallery-card.unlocked {
    background: rgba(255, 255, 255, 0.6);
    border-color: #c9a55a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-card.locked {
    opacity: 0.6;
}

.gallery-card-icon {
    font-size: 32px;
    margin-bottom: 6px;
}

.gallery-card.locked .gallery-card-icon {
    filter: grayscale(100%);
    opacity: 0.5;
}

.gallery-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #5c3d00;
    margin-bottom: 4px;
}

.gallery-card.locked .gallery-card-name {
    color: #999;
}

.gallery-card-desc {
    font-size: 11px;
    color: #8b6914;
    line-height: 1.5;
}

.gallery-card.locked .gallery-card-desc {
    color: #aaa;
}

/* 人物图鉴卡片 */
.char-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
}

.char-grid .gallery-card {
    padding: 18px 12px;
}

.char-sprite-sm {
    width: 70px;
    height: 90px;
    margin: 0 auto 8px auto;
    background: linear-gradient(180deg, #f5e6c8 0%, #e8d4a8 100%);
    border: 2px solid #c9a55a;
    border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    overflow: hidden;
}

.char-sprite-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.char-card .gallery-card-name {
    font-size: 15px;
    letter-spacing: 1px;
}

/* ============================================
   结局详情弹窗
   ============================================ */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.detail-modal {
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    background: linear-gradient(180deg, #faf0d7 0%, #f0e0b8 100%);
    border: 3px solid #c9a55a;
    border-radius: 16px;
    padding: 30px 36px 24px 36px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-close {
    position: absolute;
    top: 8px;
    right: 14px;
    font-size: 28px;
    color: #8b6914;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.detail-close:hover {
    transform: scale(1.2);
}

.detail-icon {
    font-size: 64px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.detail-title {
    font-family: "STKaiti", "KaiTi", "楷体", "SimSun", serif;
    font-size: 32px;
    font-weight: 700;
    color: #8b5a0a;
    letter-spacing: 4px;
    margin-bottom: 4px;
}

.detail-subtitle {
    font-size: 16px;
    color: #a67c00;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: 500;
}

.detail-divider {
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c9a55a, transparent);
    margin: 12px auto;
}

.detail-desc {
    font-size: 15px;
    color: #5c4030;
    line-height: 1.8;
    text-align: left;
    letter-spacing: 0.5px;
}

/* 标签页 */
.detail-tabs {
    display: flex;
    gap: 0;
    margin: 16px 0 18px 0;
    border-bottom: 2px solid #c9a55a;
}

.detail-tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #8b6914;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: "STSong", "SimSun", serif;
}

.detail-tab:hover {
    color: #5c3d00;
    background: rgba(201, 165, 90, 0.1);
}

.detail-tab.active {
    color: #5c3d00;
    border-bottom-color: #8b5a0a;
    font-weight: 700;
}

.detail-tab-content {
    text-align: left;
    margin-bottom: 20px;
    min-height: 100px;
}

/* 人生轨迹标签页 */
.detail-path-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.path-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(201, 165, 90, 0.4);
    border-radius: 8px;
    padding: 10px 14px;
}

.path-label {
    font-size: 13px;
    font-weight: 600;
    color: #8b5a0a;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.path-value {
    font-size: 14px;
    color: #5c4030;
    line-height: 1.7;
}

.detail-btn {
    padding: 10px 40px;
    font-size: 16px;
    font-weight: 600;
    color: #fff8dc;
    background: linear-gradient(180deg, #f9d36b 0%, #d99b25 45%, #a96813 100%);
    border: 2px solid #d89a28;
    border-radius: 30px;
    cursor: pointer;
    letter-spacing: 3px;
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.6),
        0 3px 8px rgba(70, 40, 0, 0.3);
    text-shadow: 0 1px 2px rgba(80, 40, 0, 0.5);
    transition: all 0.2s ease;
}

.detail-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.7),
        0 5px 12px rgba(70, 40, 0, 0.35);
}

.detail-btn:active {
    transform: translateY(1px);
}

.ending-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.ending-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================
   属性变化提示
   ============================================ */
.attr-change-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2a1a0f 0%, #1a0f0a 100%);
    border: 2px solid #c9a55a;
    padding: 16px 24px;
    border-radius: 12px;
    z-index: 2000;
    font-size: 14px;
    pointer-events: none;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.attr-change-toast.show {
    display: block;
    opacity: 1;
    animation: toastFade 1.5s ease forwards;
}

.attr-change-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    color: #e0c89a;
    font-size: 14px;
}

.attr-change-row .toast-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    margin-right: 8px;
}

.attr-change-positive {
    color: #4ade80;
    font-weight: 600;
}

.attr-change-negative {
    color: #f87171;
    font-weight: 600;
}

@keyframes toastFade {
    0% { opacity: 0; transform: translate(-50%, -40%); }
    15% { opacity: 1; transform: translate(-50%, -50%); }
    85% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -60%); }
}

/* ============================================
   新解锁提示
   ============================================ */
.unlock-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(180deg, #faf0d7 0%, #f0e0b8 100%);
    border: 3px solid #ffd700;
    border-radius: 16px;
    padding: 24px 36px;
    text-align: center;
    z-index: 3000;
    animation: unlockPop 0.5s ease forwards;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4), 0 0 60px rgba(255, 215, 0, 0.2);
    pointer-events: none;
}

@keyframes unlockPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    60% { transform: translate(-50%, -50%) scale(1.05); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================================
   背景音乐开关
   ============================================ */
.music-toggle {
    position: fixed;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(42, 26, 15, 0.75);
    border: 2px solid #c9a55a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.music-toggle:hover {
    background: rgba(201, 165, 90, 0.3);
    transform: scale(1.1);
}

.music-toggle:active {
    transform: scale(0.95);
}

.music-toggle .music-icon {
    font-size: 16px;
    line-height: 1;
}

.music-toggle.muted .music-icon {
    opacity: 0.5;
}

.music-toggle.playing .music-icon {
    animation: musicPulse 1.5s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================
   横屏提示遮罩（竖屏时显示）
   ============================================ */
#portraitMask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a0f0a 0%, #2a1a0f 50%, #1a0f0a 100%);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffd700;
    text-align: center;
    padding: 30px;
}

#portraitMask.show {
    display: flex;
}

#portraitMask.hide {
    display: none;
}

.rotate-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.portrait-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.portrait-subtitle {
    font-size: 14px;
    color: #c9a55a;
    margin-bottom: 30px;
}

.portrait-btn {
    padding: 10px 28px;
    border: 2px solid #c9a55a;
    border-radius: 22px;
    font-size: 14px;
    color: #ffd700;
    background: rgba(201, 165, 90, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.portrait-btn:active {
    background: rgba(201, 165, 90, 0.3);
}

/* ============================================
   淡入动画
   ============================================ */
.fade-in {
    animation: fadeIn 0.4s ease;
}

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

/* ============================================
   滚动条美化
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(201, 165, 90, 0.4);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 165, 90, 0.6);
}

/* 结局页和图鉴页内滚动条 */
.ending-screen::-webkit-scrollbar,
.gallery-grid::-webkit-scrollbar,
.story-content::-webkit-scrollbar {
    width: 4px;
}

.ending-screen::-webkit-scrollbar-thumb,
.gallery-grid::-webkit-scrollbar-thumb,
.story-content::-webkit-scrollbar-thumb {
    background: rgba(139, 105, 20, 0.3);
}
