/* ==========================================================================
   1. 全局变量与基础设置 (Design Tokens)
   ========================================================================== */
:root {
    /* --- 调色板 --- */
    --color-dark-bg: rgba(30, 30, 30, 0.85);   /* 深色半透明背景 (面板) */
    --color-paper: #fffdf5;                    /* 宣纸白 (弹窗) */
    --color-gold: #d4af37;                     /* 黄铜金 (边框/文字) */
    --color-red: #c0392b;                      /* 朱砂红 (强调/关闭) */
    --color-blue: #2980b9;                     /* 官服蓝 (按钮) */
    --color-text-main: #f4e4b7;                /* 米色文字 (深底上) */
    --color-text-ink: #3e2723;                 /* 墨色文字 (纸面上) */

    /* --- 字体栈 --- */
    --font-ancient: "LiSu", "KaiTi", "STKaiti", "BiauKai", serif; /* 古风标题 */
    --font-body: "Microsoft YaHei", "Heiti SC", sans-serif;       /* 易读正文 */

    /* --- 阴影与圆角 --- */
    --shadow-panel: 0 4px 15px rgba(0, 0, 0, 0.6);
    --border-radius: 4px;
}

body, html { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; }
#map { height: 100%; width: 100%; background-color: #1a1a1a; }

/* 禁用浏览器默认的聚焦蓝框 */
button:focus, input:focus { outline: none; }

/* ==========================================================================
   2. 地图标记 (Marker)
   ========================================================================== */
.map-label {
    font-family: var(--font-body);
    text-align: center;
    white-space: nowrap;
    cursor: default;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 0 5px rgba(0,0,0,0.8);
}

.pref-label {
    font-size: 20px !important;
    font-weight: 900 !important;
    color: #FFD700 !important;
    z-index: 900;
    margin-top: -10px;
    font-family: var(--font-ancient) !important;
}

.county-label, .town-label {
    font-size: 13px !important;
    font-weight: bold;
    color: #e0e0e0;
}

.county-label, .town-label { opacity: 0; visibility: hidden; }
.show-counties .county-label { opacity: 1; visibility: visible; }
.show-towns .town-label { opacity: 1; visibility: visible; }

/* ==========================================================================
   3. 顶部 UI 工具栏 (Top Bar)
   ========================================================================== */
/* 1. 顶部容器条 */

/* 1. 顶部容器条 (母舰) */
.top-ui-bar {
    position: fixed;
    top: 15px;
    right: 160px; /* 距离屏幕右边 60px，避开 Leaflet 自带的图层按钮 */
    z-index: 9999;

    display: flex;       /* 启用弹性布局 */
    align-items: center; /* 垂直居中 */
    justify-content: flex-end; /* 从右往左排 */
    gap: 10px;           /* ★ 关键：按钮之间的间距统一为 10px */

    pointer-events: none; /* 容器本身不挡鼠标 */
    white-space: nowrap;  /* 防止按钮换行 */
}

/* 2. 所有顶部元素的通用重置 (非常重要！强制取消绝对定位) */
#history-recorder,
#donate-btn,
#auth-btn,
#music-btn,
#overview-btn,
#national-treasury-display {
    position: static !important; /* ★ 核心：取消 fixed/absolute，让它们乖乖排队 */
    top: auto !important;
    right: auto !important;
    margin: 0 !important;

    pointer-events: auto; /* 恢复点击 */

    height: 38px; /* 统一高度 */
    box-sizing: border-box;

    /* 统一字体 */
    font-family: "LiSu", "KaiTi", serif;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;

    /* 统一圆角和阴影 */
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);

    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* ------------------------------------------------ */

/* C. 户部总览 */
#overview-btn {
    background: linear-gradient(to bottom, #795548, #4e342e); /* 褐色 */
    border: 1px solid #3e2723;
    color: #fff;
    padding: 0 12px;
    cursor: pointer;
}
#overview-btn:hover { filter: brightness(1.2); transform: translateY(-2px); }

/* A. 史官记载 */
#history-recorder {
    background: linear-gradient(to bottom, #2c3e50, #1a1a1a);
    color: #b8860b;
    border: 2px solid #5d4037;
    padding: 0 15px;
    cursor: default;
    min-width: 120px;
    white-space: nowrap;
}
.recorder-title { display: none; }
.recorder-data { display: flex; gap: 10px; align-items: center; }
.highlight-num { color: #e74c3c; font-family: "Arial", sans-serif; font-weight: normal; margin-left: 4px; }
.divider { color: #555; opacity: 0.5; }

/* B. 待阅奏折 */
#donate-btn {
    background: linear-gradient(180deg, #fff59d 0%, #fbc02d 50%, #f57f17 100%);
    color: #3e2723;
    border: 2px solid #bf360c;
    padding: 0 20px;
    cursor: pointer;
    white-space: nowrap;
    animation: goldBreath 3s infinite alternate;
}
@keyframes goldBreath {
    from { box-shadow: 0 0 5px rgba(255, 193, 7, 0.3); }
    to { box-shadow: 0 0 15px rgba(255, 193, 7, 0.8); }
}
#donate-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
#donate-btn:active { transform: translateY(1px); }

/* C. 验明正身 */
#auth-btn {
    background: linear-gradient(to bottom, #546e7a, #37474f);
    color: #eceff1;
    border: 2px solid #263238;
    padding: 0 20px;
    cursor: pointer;
    white-space: nowrap;
}
#auth-btn:hover { transform: translateY(-2px); background: #3e5871; }
#auth-btn:active { transform: translateY(1px); }

/* D. 军乐开关 (★ 补全样式) */
#music-btn {
    background: linear-gradient(to bottom, #8e44ad, #6c3483);
    color: #ecf0f1;
    border: 2px solid #4a235a;
    padding: 0 15px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 110px;
}
#music-btn:hover { transform: translateY(-2px); background: #9b59b6; }
#music-btn:active { transform: translateY(1px); }

/* 正在播放时的样式 */
#music-btn.playing {
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
    border-color: #1e8449;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.6);
    animation: pulseMusic 2s infinite;
}
@keyframes pulseMusic {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 红点 */
#unread-dot {
    font-size: 12px;
    margin-left: 5px;
    filter: drop-shadow(0 0 2px red);
    animation: flashRed 1.5s infinite;
}
@keyframes flashRed { from { opacity: 1; transform: scale(1); } to { opacity: 0.6; transform: scale(0.8); } }

/* ==========================================================================
   4. 左下角控制台
   ========================================================================== */
#qing-controls-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 240px;
    z-index: 9999;
    background-color: var(--color-dark-bg);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 4px;
    padding: 15px;
    color: var(--color-text-main);
    box-shadow: var(--shadow-panel);
    font-family: var(--font-body);
}

#qing-controls-container h4 {
    margin: 0 0 10px 0;
    font-family: var(--font-ancient);
    font-size: 18px;
    color: var(--color-gold);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
    text-align: center;
}

#qing-controls-container p {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 10px;
    text-align: center;
}

/* 列表样式 */
#qing-route-list {
    counter-reset: route-counter;
    list-style: none;
    padding-left: 10px;
    margin: 10px 0;
    font-size: 13px;
    max-height: 150px;
    overflow-y: auto;
    color: #ddd;
}

#qing-route-list li {
    counter-increment: route-counter;
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
}

#qing-route-list li::before {
    content: counter(route-counter) ". ";
    color: #d4af37;
    font-weight: bold;
    margin-right: 5px;
    min-width: 20px;
}

#qing-route-list li span:first-child {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eee;
}

.qing-delete-item-btn {
    cursor: pointer;
    color: #e74c3c;
    font-weight: bold;
    font-size: 16px;
    padding: 0 5px;
    margin-left: 5px;
    transition: transform 0.2s;
}
.qing-delete-item-btn:hover { color: #ff6b6b; transform: scale(1.2); }

/* 控制台按钮 */
.ctrl-btn {
    flex: 1;
    padding: 6px 0;
    font-size: 13px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #eee;
    cursor: pointer;
    transition: background 0.2s;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.2); }
.ctrl-btn[style*="background-color:#dc3545"] { background: rgba(220, 53, 69, 0.8) !important; border-color: #dc3545; }
.ctrl-btn[style*="background-color:#27ae60"] { background: rgba(39, 174, 96, 0.8) !important; border-color: #27ae60; }
.ctrl-btn[style*="background-color:#d35400"] { background: rgba(211, 84, 0, 0.8) !important; border-color: #d35400; }

/* ==========================================================================
   5. 弹窗系统 (统一古风设计)
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(3px);
}

.sanguo-frame, .zouzhe-container {
    position: relative;
    width: 65vw; /* 使用视口宽度的百分比 */
    max-width: 95%;
    min-width: 300px; /* 最小宽度确保在小屏幕上可用 */
    background: #2b1d12;
    padding: 0.8rem; /* 使用相对单位 */
    border-radius: 0.6rem;
    box-shadow: 0 0 0 0.2rem #5d4037, 0 1rem 2.5rem rgba(0,0,0,0.8);
    animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.sanguo-paper, .zouzhe-paper {
    background-color: var(--color-paper);
    background-image: linear-gradient(90deg, transparent 49px, rgba(0,0,0,0.03) 50px, transparent 51px);
    background-size: 40px 100%;
    padding: 30px;
    border: 1px solid #d7ccc8;
    color: var(--color-text-ink);
    font-family: var(--font-ancient);
}

.zouzhe-header, .sanguo-header {
    text-align: center;
    border-bottom: 2px solid var(--color-red);
    margin-bottom: 20px;
    padding-bottom: 10px;
}
.zouzhe-header h2 { margin: 0; font-size: 26px; color: #333; letter-spacing: 4px; }

.zouzhe-text, .auth-form { font-size: 20px; line-height: 1.6; }
.zouzhe-text strong { color: var(--color-red); }

.sanguo-close, .zouzhe-close {
    position: absolute;
    top: -0.8rem; right: -0.8rem;
    width: 2.5rem; height: 2.5rem;
    min-width: 2.75rem; /* 确保最小触摸区域为44px */
    min-height: 2.75rem;
    background: var(--color-red);
    color: white;
    text-align: center;
    line-height: 2.4rem;
    border: 0.15rem solid #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sanguo-close:hover { transform: scale(1.1); }

/* ==========================================================================
   6. 城市信息弹窗 (修复按钮布局)
   ========================================================================== */
.leaflet-popup-content-wrapper { background: transparent !important; box-shadow: none !important; padding: 0 !important; }
.leaflet-popup-tip { background: #2b1d12 !important; }
.leaflet-popup-close-button {
    color: #fff !important; /* 白色文字，更醒目 */
    background: #c0392b !important; /* 朱砂红背景，突出关闭功能 */
    border: 0.15rem solid #fff !important; /* 白边增加层次感 */
    border-radius: 50% !important; /* 圆形按钮，更显眼 */
    width: 2.5rem !important; /* 增大尺寸 */
    height: 2.5rem !important;
    min-width: 2.75rem !important; /* 确保最小触摸区域为44px */
    min-height: 2.75rem !important;
    line-height: 2rem !important; /* 文字居中 */
    font-size: 1.2rem !important;
    top: -0.8rem !important; /* 调整位置，突出弹窗外 */
    right: -0.8rem !important;
    box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.5) !important; /* 阴影增加立体感 */
    opacity: 1 !important; /* 取消默认半透明 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.city-popup {
    background: linear-gradient(160deg, #2c1e13 0%, #1c0f06 100%);
    border: 0.2rem solid var(--color-gold);
    outline: 0.1rem solid #5c4018;
    /* 问题1：修正 outline 偏移，解决"飞出"（二选一即可） */
    outline-offset: 0.2rem; /* 改为正数：向内偏移，不超出容器（保留轮廓线，不飞出） */
    /* 若想彻底移除飞出感，直接删除上面两行 outline 样式即可 */
    border-radius: 0.8rem;
    padding: 1.8rem 2.2rem;
    font-family: var(--font-ancient);
    color: var(--color-text-main);
    width: auto; /* 保留自适应核心 */
    min-width: 36rem; /* 增加最小宽度以容纳守将信息 */
    max-width: 95%; /* 约束最大宽度，不超屏幕 */
    box-sizing: border-box; /* 精准自适应，不撑爆 */
    /* 问题2：删除全局 white-space: nowrap; （关键！） */
    /* 原因：它会强制城市信息弹窗的多行内容挤在一行，导致布局错乱 */
    /* 问题3：恢复文本居中，符合城市信息弹窗的视觉风格 */
    text-align: center;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: visible;  /* 允许内容可见 */
}

/* 添加装饰元素 */
.city-popup::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.3rem;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}

.city-title {
    font-size: 1.6rem;
    color: var(--color-gold);
    text-align: center;
    border-bottom: 0.1rem solid rgba(212, 175, 55, 0.3);
    margin: 0 0 1.2rem 0;
    padding-bottom: 0.8rem;
    position: relative;
    text-shadow: 0 0 0.5rem rgba(212, 175, 55, 0.3);
}

.city-title::after {
    content: "";
    position: absolute;
    bottom: -0.6rem;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 0.2rem;
    background: var(--color-gold);
    border-radius: 0.1rem;
}

.city-info {
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    border-radius: 0.6rem;
    border: 0.05rem solid rgba(212, 175, 55, 0.2);
    box-shadow: inset 0 0 1rem rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;  /* 防止内容溢出 */
}
.city-info .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 0.05rem solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}
.city-info .info-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.2rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
.city-info .info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
/* 特别处理守将行，防止溢出 */
.city-info .info-row.generals-row {
    align-items: flex-start;
    min-height: auto;
}
.city-info b {
    color: #d4af37;
    font-weight: normal;
    min-width: 5rem;
    text-align: left;
    display: flex;
    align-items: center;
}
.city-info span {
    color: #f0e6d2;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    min-width: 4rem;
    text-align: right;
}

/* --- 按钮布局 --- */
.city-buttons {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    gap: 0.8rem;       /* 按钮间距 */
    margin-top: 0.5rem;
}

.btn-action {
    flex: 1;         /* 自动撑满剩余空间 */
    min-width: 40%;  /* 保证一行能放下两个 */
    border: none;
    padding: 0.9rem 0; /* 增加高度，使用相对单位 */
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    border-radius: 0.3rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-action::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
    z-index: -1;
}

.btn-action:hover, .add-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
    box-shadow: 0 0.4rem 0.8rem rgba(0,0,0,0.4);
}

.btn-action:active, .add-btn:active {
    transform: translateY(0);
    box-shadow: 0 0.1rem 0.2rem rgba(0,0,0,0.3);
}

.btn-expedition {
    background: linear-gradient(180deg, #c0392b, #a93226);
    border-bottom: 0.25rem solid #922b21;
} /* 红色系 */

.btn-march {
    background: linear-gradient(180deg, #2980b9, #2471a3);
    border-bottom: 0.25rem solid #1f618d;
}      /* 蓝色系 */

.add-btn {
    background: linear-gradient(180deg, #27ae60, #229954);
    border-bottom: 0.25rem solid #1e8449;
}        /* 绿色系 */

.add-btn {
    width: 100%;     /* 强制占满一行 */
    flex: none;      /* 不参与弹性挤压 */
    border: none;
    padding: 0.7rem 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    border-radius: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem; /* 与上面拉开距离 */
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.add-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
    z-index: -1;
}


/* ==========================================================================
   7. 调兵输入框
   ========================================================================== */
.input-wrapper { margin: 10px auto; width: 90%; }
/* ★ 修改这里：把 #tax-input 加进去，共用样式 */
#tm-input, #tax-input {
    width: 100%; padding: 0.6rem;
    background: rgba(0, 0, 0, 0.4);
    border: 0.1rem solid var(--color-gold);
    color: var(--color-gold);
    font-size: 1.2rem; text-align: center; font-weight: bold;
    border-radius: 0.4rem;
}

#tm-input:focus, #tax-input:focus {
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 8px var(--color-gold);
}

/* ==========================================================================
   8. 动画特效
   ========================================================================== */

/* 行军动画容器 */
.march-army-container {
    z-index: 2000 !important;
}

/* 行军动画关键帧 */
@keyframes marchPulse {
    from { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 100, 0, 0.8)); }
    to { transform: scale(1.1); filter: drop-shadow(0 0 30px rgba(255, 150, 0, 1)); }
}

/* 飘字动画：向上飘并淡出 - 升级版 */
@keyframes floatUpBig {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateY(-10px) scale(1.3);
    }
    50% {
        opacity: 1;
        transform: translateY(-40px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
}

/* 飘字动画原版 */
.damage-text {
    font-family: "Arial Black", sans-serif;
    font-weight: 900;
    font-size: 26px;
    text-shadow: 2px 2px 0 #000;
    position: absolute;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
}
@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) scale(1.5); }
}

/* 行军路线 */
.march-route {
    animation: routeGlow 1s infinite alternate;
}
@keyframes routeGlow {
    from { opacity: 0.4; }
    to { opacity: 0.8; }
}

/* 兵马动画 */
.horse-run {
    animation: horseBob 0.3s infinite alternate, horseShake 0.6s infinite;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}
@keyframes horseBob {
    from { transform: translateY(0) rotate(-2deg); }
    to { transform: translateY(-8px) rotate(2deg); }
}
@keyframes horseShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* 碰撞动画 */
.clash-icon svg {
    animation: clashScale 0.8s ease-out;
    transform-origin: center;
}
@keyframes clashScale {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
        filter: drop-shadow(0 0 50px #FF0000);
    }
    30% {
        transform: scale(1.5) rotate(15deg);
        opacity: 1;
        filter: drop-shadow(0 0 30px #FFD700);
    }
    60% {
        transform: scale(1.2) rotate(-10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 0 10px #FFD700);
    }
}

/* 爆炸特效 */
@keyframes explodeBig {
    0% {
        transform: scale(0.3);
        opacity: 0;
        filter: blur(10px);
    }
    20% {
        transform: scale(1.5);
        opacity: 1;
        filter: blur(0);
    }
    40% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 烟花粒子动画 */
@keyframes fireworkParticle {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* 震动效果 */
@keyframes shakeBig {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* 闪烁效果 */
@keyframes flashBig {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.5; filter: brightness(2); }
}

/* 缩放弹跳效果 */
@keyframes bounceBig {
    0% { transform: scale(0); }
    50% { transform: scale(1.5); }
    70% { transform: scale(0.8); }
    85% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 旋转入场效果 */
@keyframes spinInBig {
    0% { transform: rotate(-720deg) scale(0); opacity: 0; }
    100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

/* 脉冲发光效果 */
@keyframes pulseGlowBig {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px currentColor);
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 30px currentColor) brightness(1.3);
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px currentColor);
    }
}

/* ==========================================================================
   9. 捐赠二维码样式
   ========================================================================== */
.qr-stage { display: flex; justify-content: center; gap: 40px; margin-top: 20px; padding: 10px; background: rgba(0,0,0,0.03); }
.qr-box { text-align: center; }
.qr-frame { padding: 5px; background: #fff; border: 1px solid #ccc; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); }
.qr-frame img { width: 180px; height: 200px; display: block; }
.vermilion-remark { text-align: center; margin-top: 15px; font-size: 20px; color: var(--color-red); font-family: var(--font-ancient); transform: rotate(-2deg); }
.compliance-footer { margin-top: 20px; border-top: 1px dashed #ccc; padding-top: 10px; text-align: center; font-size: 12px; color: #999; }

/* ==========================================================================
   10. 登录表单样式
   ========================================================================== */
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; font-size: 14px; color: #5d4037; margin-bottom: 5px; font-weight: bold; }
.input-group input { width: 100%; padding: 8px; border: 1px solid #8d6e63; background: #fff; border-radius: 2px; font-size: 16px; box-sizing: border-box; }
.auth-buttons { display: flex; gap: 10px; margin-top: 20px; }

/* ================== 时间控制器 (左上角布局) ================== */
#time-panel {
    position: fixed;
    top: 12px;
    left: 60px;
    z-index: 9999;
    height: 36px;
    background: linear-gradient(to bottom, #2c3e50, #000000);
    border: 2px solid #d4af37;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
    font-family: "LiSu", "KaiTi", serif;
    color: #f4e4b7;
}

.time-display {
    display: flex;
    flex-direction: column;
    line-height: 1;
    text-align: center;
    justify-content: center;
}

#game-date {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #fff;
}

.time-controls {
    display: flex;
    gap: 5px;
    border-left: 1px solid #555;
    padding-left: 10px;
}

.time-controls button {
    background: rgba(255,255,255,0.1);
    border: 1px solid #666;
    color: #ddd;
    cursor: pointer;
    border-radius: 2px;
    padding: 2px 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.time-controls button:hover {
    background: #d4af37;
    color: #000;
    border-color: #d4af37;
}

/* ================== 财务报表专用样式 (宫廷奏章版) ================== */

.financial-report {
    width: 100%;
    box-sizing: border-box;
    font-family: "LiSu", "KaiTi", serif; /* 统一隶书/楷体 */
    display: flex;
    flex-direction: column;
    gap: 12px; /* 增加一点呼吸感 */
    margin-top: 5px;
}

/* 1. 顶部日期栏 (改为深色匾额风格，解决看不清的问题) */
.report-header {
    /* 深红渐变背景，模拟官印或匾额 */
    background: linear-gradient(to bottom, #8b0000, #5d1010);
    border: 2px solid #d4af37; /* 金边 */
    border-radius: 4px;
    padding: 8px 0;

    text-align: center;
    font-size: 20px; /* 加大字号 */
    font-weight: bold;
    color: #ffd700; /* 金字在深红底上非常清晰 */
    letter-spacing: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 0 #000;
}

/* 2. 中间数据区 */
.report-grid {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* 单个数据卡片 */
.report-card {
    flex: 1;
    /* 半透明深褐色背景，与宣纸形成层次感 */
    background: rgba(62, 39, 35, 0.1);
    border: 1px solid #8d6e63;
    border-radius: 6px;
    padding: 10px 5px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.report-card:hover {
    background: rgba(62, 39, 35, 0.2);
    transform: translateY(-2px);
}

.report-card .label {
    font-size: 15px;
    color: #5d4037; /* 深褐色标签 */
    font-weight: bold;
    margin-bottom: 5px;
}

.report-card .value {
    font-family: "Arial", sans-serif; /* 数字用无衬线体 */
    font-weight: 900;
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* 收入绿色，支出红色 */
.value.income { color: #27ae60; }
.value.expense { color: #c0392b; }

/* 3. 分割线 (朱砂红虚线) */
.report-divider {
    height: 0;
    border-top: 2px dashed #c0392b;
    opacity: 0.3;
    margin: 5px 0;
}

/* 4. 底部总计 (强调显示) */
.report-total {
    display: flex;
    justify-content: space-between;
    align-items: center;

    /* 深色底板，突出重点 */
    background: linear-gradient(to right, #3e2723, #212121);
    padding: 10px 20px;
    border-radius: 4px;
    border: 1px solid #d4af37;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.report-total .label {
    font-size: 18px;
    color: #ffd700; /* 金色标题 */
    font-weight: bold;
    letter-spacing: 1px;
}

.report-total .value {
    font-size: 24px;
    font-weight: bold;
    font-family: "Arial", sans-serif;
    /* 数字带发光效果 */
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* ================== 历史事件弹窗样式 (史诗重制版) ================== */

/* 1. 弹窗容器内的通用文字设置 */
.history-container {
    padding: 0 10px;
    color: #f4e4b7; /* 全局米黄色文字 */
    font-family: "LiSu", "KaiTi", serif; /* 隶书/楷体 */
}

/* 2. 标题美化 */
.history-title {
    color: #e74c3c; /* 血红色 */
    font-size: 32px;
    font-weight: 900;
    margin: 0 0 5px 0;
    letter-spacing: 5px;
    text-shadow: 0 2px 10px rgba(231, 76, 60, 0.5); /* 红色光晕 */
    text-align: center;
}

/* 3. 日期副标题 */
.history-date {
    font-size: 16px;
    color: #d4af37; /* 暗金色 */
    margin-bottom: 20px;
    font-family: "Times New Roman", serif;
    letter-spacing: 2px;
    text-align: center;
    opacity: 0.8;
}

/* 4. 图片容器 (电影感) */
.history-gallery {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.history-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover; /* 裁剪适应 */
    border: 2px solid #5d4037;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8); /* 深邃投影 */
    filter: sepia(0.3) contrast(1.2); /* 稍微做旧 */
}

/* 5. 历史描述文本 (变宽版) */
.history-desc {
    text-align: left;
    font-size: 19px;
    line-height: 1.8;

    color: #fffdf5;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.5));

    border-left: 3px solid #c0392b;
    border-right: 3px solid #c0392b;

    /* ★★★ 核心修改：强制变宽 ★★★ */
    width: 100%;            /* 占满整个弹窗宽度 */
    box-sizing: border-box; /* 确保内边距不会撑爆宽度 */
    margin: 15px 0;         /* 上下留空，左右顶格 */
    padding: 15px 15px;     /* 左右内边距稍微改小一点点 */

    text-indent: 2em;
    text-shadow: 1px 1px 2px #000;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    border-radius: 4px;
}

/* 6. 底部警告文字 */
.history-warning {
    font-size: 13px;
    color: #e67e22;      /* 橙色警告 */
    margin-top: 15px;
    text-align: center;
    font-family: "Microsoft YaHei", sans-serif;
    opacity: 0.9;
}
/* ================== 城市弹窗细节优化 ================== */

/* 1. 通用行样式 */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 2px;
}

/* 2. 迷你按钮 (调整税率用) */
.btn-mini {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    background: linear-gradient(180deg, #555, #444);
    border: 0.1rem solid #666;
    color: white;
    border-radius: 0.3rem;
    cursor: pointer;
    min-height: 2.75rem; /* 确保最小触摸区域为44px */
    min-width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 0.1rem 0.2rem rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.btn-mini::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
    z-index: -1;
}
.btn-mini:hover {
    background: linear-gradient(180deg, #666, #555);
    transform: translateY(-1px);
    box-shadow: 0 0.2rem 0.4rem rgba(0,0,0,0.4);
}
.btn-mini:active {
    transform: translateY(0);
    box-shadow: 0 0.1rem 0.1rem rgba(0,0,0,0.3);
}

/* 3. 守将区域容器 */
.generals-section {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.3); /* 深色底 */
    border-radius: 0.4rem;
    padding: 0.6rem;
    border: 0.1rem solid rgba(212, 175, 55, 0.3);
    box-shadow: inset 0 0 0.5rem rgba(0,0,0,0.3);
}

.sec-title {
    font-size: 0.85rem;
    color: #bbb;
    margin-bottom: 0.4rem;
    border-bottom: 0.1rem solid rgba(255,255,255,0.1);
    padding-bottom: 0.2rem;
    font-weight: bold;
}

/* 4. 武将列表 (Flex 自动换行) */
.generals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem; /* 标签之间的间距 */
    justify-content: flex-end; /* 靠右对齐 */
}

/* ================== 守将列表垂直布局优化 ================== */

/* 1. 右侧武将容器 (垂直堆叠) */
.generals-col {
    display: flex;
    flex-direction: column; /* ★ 关键：垂直排列 */
    align-items: stretch;  /* ★ 关键：拉伸对齐 */
    gap: 0.4rem;           /* 每个武将之间的间距 */
    flex: 1;                /* 占据剩余空间 */
    padding: 0.2rem;        /* 内边距 */
    border-radius: 0.2rem;  /* 圆角 */
    width: 100%;            /* 确保宽度不超过容器 */
    box-sizing: border-box; /* 包含边框和内边距 */
}

/* 2. 单个武将标签 (微调样式) */
.general-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #4a3728, #3a2b1d);
    border: 0.1rem solid #8d6e63;
    border-radius: 0.3rem;
    padding: 0.5rem 0.8rem; /* 稍微加大一点内边距 */
    box-shadow: 0 0.2rem 0.4rem rgba(0,0,0,0.3);
    min-width: 10rem; /* 给个最小宽度，保证整齐 */
    width: 100%;      /* 适应容器宽度 */
    transition: all 0.2s ease;
    flex-shrink: 0;   /* 防止收缩 */
}

.general-tag:hover {
    background: linear-gradient(180deg, #5a4738, #4a3b2d);
    transform: translateY(-1px);
    box-shadow: 0 0.3rem 0.6rem rgba(0,0,0,0.4);
}

.gen-name {
    font-size: 0.9rem;
    color: #f4e4b7; /* 米色字 */
    font-weight: bold;
    white-space: nowrap; /* 防止文字换行 */
    overflow: hidden;    /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 显示省略号 */
}

.gen-stat {
    font-size: 0.75rem;
    color: #bbb;
    font-family: "Arial", sans-serif;
    margin-left: 0.6rem;
}

/* ================== 防重叠专用样式 ================== */

/* 模拟 Canvas 的绿色圆点 (用于重叠时的在野县城) */
.wild-county-dot {
    background-color: #2e8b57; /* 绿色 */
    border: 1px solid #fff;    /* 白边 */
    border-radius: 50%;        /* 圆形 */
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    width: 12px !important;
    height: 12px !important;
}

/* ================== 11. 地图资源飘字特效 ================== */
.resource-float {
    font-family: "Arial Black", sans-serif;
    font-weight: 900;
    font-size: 14px;
    position: absolute;
    pointer-events: none; /* 不挡鼠标 */
    white-space: nowrap;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
    animation: floatUpFade 2.5s ease-out forwards;
    opacity: 0;
    z-index: 5000;
}

/* 飘字动画：向上飘并淡出 */
@keyframes floatUpFade {
    0% { opacity: 0; transform: translateY(0) scale(0.8); }
    10% { opacity: 1; transform: translateY(-10px) scale(1.2); }
    80% { opacity: 1; transform: translateY(-40px) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ================== 12. 奏折列表样式 (信箱模式) ================== */

/* 列表容器 */
.report-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 10px;
    border-top: 1px solid #d4af37;
    padding-top: 10px;
}

/* 单条奏折 */
.report-item {
    background: rgba(62, 39, 35, 0.1);
    border: 1px solid #8d6e63;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-item:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: translateX(5px);
}

/* 未读状态 */
.report-item.unread {
    border-left: 4px solid #c0392b;
    background: rgba(255, 255, 255, 0.5);
}

.report-item-title {
    font-size: 16px;
    font-weight: bold;
    color: #3e2723;
}

.report-item-date {
    font-size: 12px;
    color: #888;
}

/* 详情视图 (默认隐藏) */
.report-detail-view {
    display: none; /* JS控制显示 */
    text-align: left;
}

.back-btn {
    font-size: 14px;
    color: #555;
    cursor: pointer;
    margin-bottom: 10px;
    display: inline-block;
    padding: 5px 10px;
    background: #eee;
    border-radius: 4px;
}
.back-btn:hover { background: #ddd; }

/* 户部/军机处 印章 */
.ministry-stamp {
    position: absolute;
    top: -5px;      /* 稍微往上提一点，防止挡住下面的标题 */
    left: 10px;

    /* 样式设置 */
    border: 4px solid #c0392b; /* 边框加粗一点，更有质感 */
    color: #c0392b;            /* 朱砂红 */
    padding: 4px 10px;         /* 内边距加大 */

    font-weight: 900;          /* 特粗 */
    font-size: 24px;           /* ★★★ 核心修改：字体变大 (原14px) ★★★ */
    font-family: "LiSu", "KaiTi", serif; /* 强制隶书，更有印章感 */

    transform: rotate(-10deg); /* 保持倾斜 */
    border-radius: 6px;        /* 稍微圆角，像磨损的印章 */
    opacity: 0.85;             /* 半透明 */

    /* 增加一点印泥的模糊感 */
    text-shadow: 0 0 2px rgba(192, 57, 43, 0.5);
    box-shadow: inset 0 0 5px rgba(192, 57, 43, 0.3);
}

/* ================== 武将选择列表样式 ================== */
.general-select-box {
    margin: 10px 0;
    text-align: left;
}

.gen-list-container {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #5d4037;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 4px;
    /* 自定义滚动条 */
    scrollbar-width: thin;
    scrollbar-color: #d4af37 #2b1d12;
}

/* 单个武将选项 */
.gen-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 4px;
    background: #3e2723;
    border: 1px solid #5d4037;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    color: #aaa;
}

.gen-option:hover {
    background: #4e342e;
    color: #fff;
}

/* 选中状态 (高亮) */
.gen-option.selected {
    background: linear-gradient(to right, #c0392b, #8e24aa); /* 红紫渐变，显眼 */
    border-color: #ffd700;
    color: #ffd700;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.gen-option-stats {
    font-size: 12px;
    font-family: "Arial", sans-serif;
}

/* ================== 11. 招贤馆样式 (卡片布局) ================== */
.hero-intro { text-align: center; margin-bottom: 20px; font-family: "KaiTi", serif; }

.recruit-options { display: flex; gap: 15px; justify-content: center; }

/* 招募卡片按钮 */
.recruit-card {
    flex: 1;
    background: #fff;
    border: 2px solid #aaa;
    border-radius: 6px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.recruit-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.recruit-card:active { transform: translateY(1px); }

/* 普通招募 */
.recruit-card.normal { border-color: #7f8c8d; }
.recruit-card.normal .card-title { color: #2c3e50; font-weight: bold; font-size: 18px; margin-bottom: 5px; }

/* 高级招募 */
.recruit-card.elite { border-color: #d4af37; background: linear-gradient(to bottom, #fff, #fffde7); }
.recruit-card.elite .card-title { color: #d35400; font-weight: bold; font-size: 18px; margin-bottom: 5px; }

.card-cost { font-weight: bold; color: #f39c12; margin-bottom: 8px; font-size: 16px; }
.card-desc { font-size: 12px; color: #777; line-height: 1.4; }

/* 结果展示的大号标签 */
.hero-card-result {
    background: #2b1d12;
    border: 1px solid #d4af37;
    padding: 8px 12px;
    border-radius: 4px;
    text-align: left;
    width: 120px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
.hero-card-result .name { font-weight: bold; font-size: 16px; margin-bottom: 4px; }
.hero-card-result .stats { color: #ccc; font-size: 12px; font-family: Arial; }


/* ================== 12. 户部总览样式 (表格) ================== */
#empire-stats div { display: inline-block; width: 45%; margin-bottom: 5px; font-weight: bold; color: #5d4037; }

#empire-list-body tr { border-bottom: 1px solid #ddd; }
#empire-list-body tr:nth-child(even) { background: rgba(0,0,0,0.02); }
#empire-list-body td { padding: 6px; text-align: center; color: #333; font-size: 18px; }

/* ================== 人才录用界面样式 ================== */

/* 待录用武将卡片 */
.hire-card {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid #8d6e63;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 武将信息行 */
.hire-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hire-name {
    font-size: 18px;
    font-weight: bold;
    color: #3e2723;
    font-family: "LiSu", serif;
}

.hire-stats {
    font-size: 14px;
    color: #555;
    font-family: "Arial", sans-serif;
}

.hire-desc {
    font-size: 12px;
    color: #888;
    font-style: italic;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

/* 操作行 (指派城市) */
.hire-action {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 城市选择下拉框 */
.city-select {
    flex: 1;
    padding: 5px;
    border: 1px solid #d4af37;
    background: #fff;
    border-radius: 4px;
    font-family: "Microsoft YaHei", sans-serif;
}

/* 录用按钮 */
.btn-hire {
    background: #27ae60;
    color: white;
    border: 1px solid #1e8449;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.btn-hire:hover { background: #2ecc71; }
.btn-hire:disabled { background: #ccc; border-color: #aaa; cursor: not-allowed; }

/* ================== 户部总览表头修复 ================== */

/* 1. 强制整行表头背景色 */
#empire-list-header {
    background-color: #5d4037 !important; /* 深褐色 */
}

/* 2. 表头单元格样式 */
#empire-list-header th {
    background-color: #5d4037 !important; /* ★ 关键：强制每个格子都是深色底 */
    color: #f4e4b7 !important;            /* ★ 关键：米黄色文字 (比纯白更清晰) */
    padding: 10px 4px;                    /* 增加一点高度 */
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #d4af37;     /* 底部加一条金线区分 */
    border-right: 1px solid rgba(255,255,255,0.1); /* 列之间加淡淡的分割线 */
    font-family: "LiSu", "KaiTi", serif;  /* 隶书字体 */
    font-size: 16px;
    white-space: nowrap;                  /* 防止文字换行 */
}

/* 3. 鼠标悬停效果 */
#empire-list-header th:hover {
    background-color: #3e2723 !important; /* 鼠标放上去变深 */
    color: #ffd700 !important;            /* 文字变亮金 */
}

/* 4. 排序箭头图标 */
.sort-icon {
    font-size: 12px;
    margin-left: 2px;
    color: #ffd700; /* 金色箭头 */
}

/* ========== 军情通报弹窗专属：自适应宽度 + 整体居中（不影响其他弹窗） ========== */
.msg-popup-adaptive {
    width: auto !important; /* 自动适配内部内容宽度（核心） */
    min-width: 20rem; /* 兜底：避免内容过少时弹窗过窄 */
    max-width: 90%; /* 约束：避免内容过多时超出屏幕 */
    box-sizing: border-box; /* 内边距/边框不撑爆宽度 */
    margin: 0 auto !important; /* 关键：让弹窗本身在父容器中水平居中 */
    text-align: center !important; /* 恢复弹窗内部文本居中（满足你的需求） */
    margin-bottom: 0.5rem !important; /* 覆盖行内样式，缩减标题下方间距 */
}

/* 优化军情通报弹窗内部内容，保留同行显示，兼顾居中美观 */
#msg-content {
    white-space: pre-line !important; /* 保留手动换行（如可进军目标列表），不自动换行 */
    display: block !important; /* 取消原有的 flex 居中，避免文本被挤压 */
    align-items: normal !important;
    justify-content: normal !important;
    margin: 0 auto !important; /* 内部内容块也居中，适配自适应宽度 */
}

/* ==========================================================================
   响应式设计和触摸优化
   ========================================================================== */

/* 针对小屏幕设备的优化 */
@media (max-width: 768px) {
    .city-popup {
        padding: 1rem;
        min-width: 20rem; /* 在小屏幕上使用更小的最小宽度 */
    }

    .city-title {
        font-size: 1.3rem;
    }

    .city-info {
        font-size: 0.8rem;
    }

    .btn-action, .add-btn {
        padding: 0.7rem 0;
        font-size: 0.85rem;
    }

    .btn-mini {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        min-height: 2.75rem;
        min-width: 2.75rem;
    }

    .sanguo-frame, .zouzhe-container {
        width: 90vw;
        padding: 0.6rem;
    }

    .zouzhe-header h2 {
        font-size: 1.5rem;
    }

    .zouzhe-text, .auth-form {
        font-size: 0.9rem;
    }
}

/* 针对触摸设备的优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-action, .add-btn, .btn-mini {
        /* 增加触摸目标的大小 */
        padding: 0.8rem 0.6rem;
        min-height: 2.75rem; /* 确保至少44px的触摸区域 */
        min-width: 2.75rem;
    }

    .city-buttons {
        gap: 0.6rem; /* 在触摸设备上增加按钮间距 */
    }
}

/* 针对高分辨率屏幕的优化 */
@media (min-resolution: 2dppx) {
    .city-popup {
        border-radius: 0.7rem;
        box-shadow: 0 0 40px rgba(0,0,0,0.9);
    }
}
/* ================= 成就系统样式 ================= */

/* 右上角成就图标 */
.achievement-icon {
    position: fixed;
    top: 120px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #d4af37 0%, #8b6914 100%);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #ffd700;
    transition: all 0.3s ease;
    user-select: none;
}

.achievement-icon:hover {
    transform: scale(1.05);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 成就解锁通知 */
.achievement-unlock {
    text-align: center;
    padding: 20px;
}

.unlock-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.unlock-icon {
    font-size: 48px;
    animation: unlockPulse 1s ease-in-out;
}

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

.unlock-title {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.unlock-content h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #3e2723;
}

.unlock-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
}

.unlock-rewards {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.reward-item {
    padding: 8px 16px;
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: white;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 成就列表 - 垂直列表布局，带滚动条 */
.achievement-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 5px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f5f5f0;
    border: 1px solid #d4d4d4;
    transition: all 0.3s ease;
    flex-direction: row;
    min-height: 85px;
}

.achievement-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border: 2px solid #ffd700;
    box-shadow:
        0 2px 8px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.achievement-item.locked {
    opacity: 0.7;
    filter: grayscale(50%);
}

.achievement-icon-display {
    font-size: 32px;
    min-width: 45px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-info h4 {
    margin: 0 0 6px 0;
    font-size: 18px;
    color: #3e2723;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.achievement-status {
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.achievement-status.unlocked {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: white;
}

.achievement-status.locked {
    background: #7f8c8d;
    color: white;
}

.achievement-info p {
    margin: 0;
    font-size: 15px;
    color: #555;
    line-height: 1.4;
}

.achievement-progress {
    margin-top: 8px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.achievement-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 50%, #a8e6cf 100%);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.achievement-progress-text {
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    text-align: right;
    font-weight: 500;
}

.achievement-rewards {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 4px;
    flex-wrap: wrap;
}

.achievement-reward {
    font-size: 13px;
    padding: 4px 10px;
    background: rgba(139, 105, 20, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(139, 105, 20, 0.3);
    font-weight: 500;
}

/* 标签页样式 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    background: #e8e8e8;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    color: #555;
    transition: all 0.3s ease;
    user-select: none;
}

.tab-btn:hover {
    background: #d5d5d5;
    border-color: #a0a0a0;
}

.tab-btn.active {
    background: linear-gradient(135deg, #d4af37 0%, #8b6914 100%);
    color: white;
    border-color: #ffd700;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.block {
    display: block;
}

/* 成就分类标题 */
.achievement-category {
    margin-bottom: 10px;
}

.category-title {
    font-size: 16px;
    color: #3e2723;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #d4af37;
}

/* 成就外层滚动容器 */
.achievement-wrap {
    height: 60vh;
    overflow-y: auto;
    padding: 0 8px;
    box-sizing: border-box;
}

/* 城市弹窗守将行特殊布局 */
.city-info .info-row.generals-row {
    flex-direction: column;
    align-items: flex-start;
}

.city-info .info-row.generals-row b {
    margin-bottom: 8px;
    margin-top: 0;
}

.generals-col {
    width: 100%;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.generals-col > div {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.generals-col button {
    background: #c0392b !important;
    color: white !important;
    border: none !important;
    border-radius: 4px;
    padding: 4px 10px !important;
    font-size: 12px !important;
    cursor: pointer;
    white-space: nowrap;
}

.category-title {
    font-size: 20px;
    color: #3e2723;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #d4af37;
    font-weight: bold;
}

/* 成就外层滚动容器 */
.achievement-wrap {
    height: 60vh;
    overflow-y: auto;
    padding: 0 8px;
    box-sizing: border-box;
}

/* ==========================================================================
    攻城器械选择样式
    ========================================================================== */

/* 攻城器械选项容器 */
#equipment-select {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    border: 1px dashed #666;
}

/* 攻城器械选项 */
.equipment-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #666;
    border-radius: 4px;
    padding: 10px 5px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.equipment-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #f1c40f;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.equipment-option.selected {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.equipment-option.selected > div:first-child {
    transform: scale(1.1);
    animation: pulse 1s ease-in-out infinite;
}

/* 攻城器械名称颜色 */
.equipment-option div:nth-child(2) {
    color: #f4e4b7;
    font-weight: bold;
}

.equipment-option.selected div:nth-child(2) {
    color: #f1c40f;
}

/* 攻城器械加成 */
.equipment-option div:nth-child(3) {
    color: #2ecc71;
    font-size: 10px;
}

/* 艉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 攻城器械信息提示 */
#equipment-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #d4af37;
    transition: all 0.3s ease;
}


