
body {
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
    overflow: hidden;
    margin: 0;
    color: #102a43;
    /* 防止移动端页面滚动和橡皮筋效果 */
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

/* 视觉隐藏但保留在可访问性树中，供搜索引擎抓取静态内容 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- 地图容器 --- */
    #map-container {
        width: 100vw;
        height: 100vh;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
        /* 移动端优化触摸交互 */
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        /* 性能优化：增强 GPU 加速的稳定性 */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        perspective: 1000px;
    }

.country {
    fill: #bcccdc; 
    stroke: #fff;
    stroke-width: 0.8px;
    vector-effect: non-scaling-stroke; 
    transition: fill 0.3s ease, stroke 0.3s ease, filter 0.3s ease, stroke-width 0.3s ease;
    cursor: pointer;
    /* 移动端优化触摸 */
    -webkit-tap-highlight-color: transparent;
}

.country:hover {
    fill: #486581;
    stroke: #334e68;
    filter: drop-shadow(0 4px 8px rgba(16, 42, 67, 0.2));
}

.country.active {
    fill: #d64545;
    stroke: #a61b1b;
    stroke-width: 1.5px;
}

.country-label {
    pointer-events: none; 
    text-anchor: middle;
    fill: #102a43;
    font-weight: 700;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
    transition: opacity 0.2s ease; 
}

/* --- 侧边栏 --- */
#sidebar {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 380px; 
    height: calc(100vh - 48px);
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px); 
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: visible;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

/* 移动端侧边栏遮罩层 */
#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#sidebar-overlay.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* --- 侧边栏折叠按钮 --- */
.sidebar-toggle {
    position: fixed;
    top: 48px;
    left: 404px;
    transform: none;
    width: 32px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle:hover {
    background: #ffffff;
    width: 36px;
}

.toggle-icon {
    color: #667eea;
    font-size: 14px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

/* 折叠状态 - 左滑隐藏 */
#sidebar.collapsed {
    transform: translateX(calc(-100% + 32px));
}

.sidebar-toggle.collapsed {
    left: 56px;
    border-radius: 0 12px 12px 0;
}

.sidebar-toggle.collapsed .toggle-icon {
    transform: rotate(180deg);
}

#sidebar.collapsed .sidebar-topband,
#sidebar.collapsed #rank-list,
#sidebar.collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
}

#sidebar .sidebar-topband,
#sidebar #rank-list,
#sidebar .sidebar-footer {
    transition: opacity 0.3s ease;
}

/* --- 收起后的窄轨：折叠时 #sidebar 只在左侧露出 32px，这一段正好由窄轨填满并显示竖排标题，
       不再是「什么都不显示」的一条空白。展开状态用 visibility 隐藏，顺带移出 Tab 序与读屏树，
       否则这 32px 的透明热区会挡住侧边栏右缘的点击。 --- */
.sidebar-rail {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    /* 与 .sidebar-topband 同一套渐变配色，收起/展开两个状态看起来是同一个面板 */
    background: linear-gradient(170deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 19px 19px 0;
    color: #ffffff;
    font-family: inherit;
    cursor: pointer;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar.collapsed .sidebar-rail {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.sidebar-rail-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase; /* 拉丁/西里尔语排成大写，像书脊；CJK 不受影响 */
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: letter-spacing 0.3s ease;
    /* 竖排。拉丁/西里尔语整体转 180° 变成自下而上（书脊方向）；CJK/韩文保持自上而下、字形正立 */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

html[lang^="zh"] .sidebar-rail-label,
html[lang^="ja"] .sidebar-rail-label,
html[lang^="ko"] .sidebar-rail-label {
    transform: none;
}

.sidebar-rail:hover .sidebar-rail-label,
.sidebar-rail:focus-visible .sidebar-rail-label {
    letter-spacing: 0.32em;
}

/* 顶栏（标题 + Tab + 搜索框）：整条只画一次渐变，避免各区块渐变重置产生交界硬边 */
.sidebar-topband {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    flex-shrink: 0;
}

.sidebar-header {
    /* 右边距 20px（不是 28px）：与下方 .tab-group 的左右 20px 对齐，
       让「2025 Statistics」徽章的右缘正好落在 GDP (USD) 标签的右缘上；
       同时比原来的 28px 多给标题 8px 空间，减少长语言标题换行 */
    padding: 18px 20px 16px 28px;
    color: white;
    position: relative;
    overflow: hidden;
}

.header-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-main h1 {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin: 0;
    /* 24px（原 1.875rem/text-3xl = 30px）：380px 侧边栏下最长标题
       （fr「Carte du monde」231px、pt「Mapa Mundial」209px、es「Mapa mundial」207px）
       在 30px 时会超过可用宽度而折成两行，缩到 24px 后仍余约 20px 空间，10 种语言均可单行。
       注意：字号由本规则决定，h1 上的 .text-3xl 工具类特异性更低，会被这里覆盖 */
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 900;    /* font-black */
    letter-spacing: -0.025em; /* tracking-tight */
}

.header-badge {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    margin-bottom: 2px;
}

.tab-group {
    display: flex;
    padding: 20px 20px 12px;
    gap: 8px;
    margin: 0;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-family: inherit;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
}

.tab-btn.active {
    color: #fff;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tab-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.tab-note {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
    opacity: 0.9;
}

.tab-btn.active .tab-note {
    color: rgba(255,255,255,0.9);
}

#rank-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.05), transparent);
    border-radius: 0 0 20px 20px;
}

/* 右上角操作区内的「关于本站」链接 */
#language-switcher .about-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #486581;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
}

#language-switcher .about-link:hover,
#language-switcher .about-link:focus-visible {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    outline: none;
}

.lang-divider {
    width: 1px;
    align-self: stretch;
    margin: 6px 0;
    background: rgba(72, 101, 129, 0.18);
}

/* --- 关于本站页面 --- */
body.about-page {
    position: static;
    width: auto;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: #f0f4f8;
    touch-action: auto;
}

.about-page .about-shell {
    width: min(920px, calc(100% - 40px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.about-page .about-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 48px;
}

.about-page .back-link {
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.about-page .back-link:hover,
.about-page .back-link:focus-visible {
    color: #3b4cca;
    outline: none;
}

/* 关于页语言切换：与主页同款下拉（.lang-dropdown 等通用样式见下方「语言切换」区块） */
.about-page .about-language-switcher {
    display: flex;
}

.about-page .about-intro {
    max-width: 700px;
    margin-bottom: 42px;
}

.about-page .about-kicker {
    margin: 0 0 12px;
    color: #486581;
    font-size: 14px;
    font-weight: 700;
}

.about-page h1 {
    margin: 0;
    color: #102a43;
    font-size: 38px;
    line-height: 1.18;
}

.about-page .about-lead {
    margin: 18px 0 0;
    color: #334e68;
    font-size: 18px;
    line-height: 1.75;
}

.about-page .about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.about-page .about-section {
    padding: 24px;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
}

.about-page .about-section.wide {
    grid-column: 1 / -1;
}

.about-page .about-section h2 {
    margin: 0 0 12px;
    color: #102a43;
    font-size: 19px;
    line-height: 1.35;
}

.about-page .about-section p,
.about-page .about-section li {
    color: #486581;
    font-size: 15px;
    line-height: 1.7;
}

.about-page .about-section p {
    margin: 0;
}

.about-page .about-section ul {
    margin: 0;
    padding-left: 20px;
}

.about-page .about-section a {
    color: #3b4cca;
}

.about-page .about-footer {
    margin-top: 24px;
    color: #627d98;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 768px) {
    .about-page .about-shell {
        width: min(100% - 32px, 620px);
        padding-top: 20px;
    }

    .about-page .about-nav {
        margin-bottom: 34px;
    }

    .about-page h1 {
        font-size: 31px;
    }

    .about-page .about-lead {
        font-size: 16px;
    }

    .about-page .about-grid {
        grid-template-columns: 1fr;
    }

    .about-page .about-section.wide {
        grid-column: auto;
    }
}

/* --- 404 页面 --- */
.notfound-page .notfound-shell {
    text-align: center;
}

.notfound-card {
    margin: 10vh auto 0;
    padding: 48px 40px;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
    max-width: 480px;
}

.notfound-code {
    font-size: 92px;
    font-weight: 800;
    line-height: 1;
    color: #bcccdc;
}

.notfound-page h1 {
    margin-top: 4px;
    font-size: 30px;
}

.notfound-lead {
    margin: 14px 0 28px;
    color: #486581;
    font-size: 16px;
    line-height: 1.7;
}

.notfound-home {
    display: inline-block;
    padding: 12px 26px;
    color: #ffffff;
    background: #486581;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease;
}

.notfound-home:hover,
.notfound-home:focus-visible {
    background: #3b4cca;
    outline: none;
}

@media (max-width: 768px) {
    .notfound-card {
        margin-top: 6vh;
        padding: 36px 24px;
    }

    .notfound-code {
        font-size: 72px;
    }

    .notfound-page h1 {
        font-size: 25px;
    }
}

.rank-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 28px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.02);
    transition: background 0.2s;
    opacity: 0;
    transform: translateX(-10px);
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}

.rank-item:hover {
    background: rgba(255, 255, 255, 0.95);
}

.rank-item.highlighted .rank-num {
    color: #667eea;
    font-weight: 900;
}

.rank-item.highlighted .country-name {
    color: #667eea !important;
    font-weight: 900;
    position: relative;
    padding: 0 6px;
    margin: 0 -6px;
    display: inline-block;
    line-height: 1.5;
    vertical-align: baseline;
}

.rank-item.highlighted .country-name::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 4px;
    z-index: -1;
}

.progress-bg {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #e6f0fa; 
    border-right: 3px solid #bee3f8;
    z-index: 0;
    width: 0; 
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.rank-content {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.rank-num {
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 900;
    width: 24px;
    text-align: center;
    margin-right: 12px;
    color: #829ab1;
    font-size: 14px;
}

.rank-1 .rank-num { color: #d69e2e; font-size: 18px; text-shadow: 0 1px 2px rgba(214, 158, 46, 0.2); }
.rank-2 .rank-num { color: #718096; font-size: 17px; }
.rank-3 .rank-num { color: #a66e4e; font-size: 16px; }

.value-text {
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 600;
    color: #486581;
    font-size: 13px;
}

#rank-list::-webkit-scrollbar {
    width: 10px;
    background: transparent;
    height: 0px; /* Hide horizontal scrollbar */
}
#rank-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
    margin: 10px 0;
    border-radius: 5px;
}
#rank-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 5px;
    border: 2px solid #fff;
}
#rank-list::-webkit-scrollbar-thumb:hover {
    background: #9fb3c8;
}
/* Hide horizontal scrollbar for Firefox */
#rank-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    overflow-x: hidden; /* Ensure horizontal scrollbar is hidden */
}

/* --- Tooltip --- */
#tooltip {
    position: absolute;
    padding: 8px 16px; 
    background: rgba(16, 42, 67, 0.95); 
    color: #fff;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 100;
}

/* --- 地图角注（免责声明，链接 about 页） --- */
.map-attribution {
    position: absolute;
    left: 424px;            /* 避开 404px 宽的侧边栏 */
    bottom: 10px;
    z-index: 5;
    pointer-events: none;   /* 容器不拦截地图拖拽 */
    line-height: 1;
}
.map-attribution a {
    pointer-events: auto;
    display: inline-block;
    font-size: 11px;
    color: rgba(45, 55, 72, 0.55);
    background: rgba(255, 255, 255, 0.72);
    padding: 3px 10px;
    border-radius: 10px;
    text-decoration: none;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.map-attribution a:hover { color: #2d3748; }
@media (max-width: 768px) {
    .map-attribution { left: 12px; bottom: 8px; }
}

/* --- 国家详情弹窗 --- */
#country-detail {
    position: fixed;
    top: 50%;
    left: calc(404px + (100vw - 404px) / 2);
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: calc(100vw - 424px);
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    z-index: 200;
    display: none;
    overflow: hidden;
}

.country-detail-header {
    padding: 24px 28px;
    background: linear-gradient(135deg, #2b6cb0 0%, #2c5282 100%);
    color: white;
    position: relative;
}

.country-detail-header h2 {
    font-size: 2.8rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: #ffffff;
    font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
    padding-right: 40px; /* Make space for close button */
}

/* ========== 移动端适配 ========== */

/* 平板和移动设备 */
@media (max-width: 768px) {
    /* 侧边栏改为全屏抽屉式 */
    #sidebar {
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    #sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    #sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .sidebar-toggle {
        left: 16px;
        right: auto;
        top: 16px;
        border-radius: 12px;
        width: 40px;
        height: 40px;
    }
    
    /* 开关位于抽屉外，收起后仍可重新打开 */
    .sidebar-toggle.collapsed {
        left: 16px;
        background: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 60;
    }
    
    .sidebar-toggle.collapsed .toggle-icon {
        color: #667eea;
        transform: rotate(180deg);
    }
    
    .sidebar-header {
        padding-left: 72px;
    }

    /* 抽屉式侧边栏宽度 = 100vw，左侧还要让出 72px 开关位，标题空间比桌面的 380px 更窄；
       故按视口弹性缩字（480px 以上封顶 24px，窄屏最小 16px），尽量保证长语言标题仍是单行 */
    .header-main h1 {
        font-size: clamp(1rem, 5vw, 1.5rem);
    }
    
    /* 侧边栏遮罩层在移动端显示 */
    #sidebar-overlay {
        display: block;
    }
    
    /* 国家详情弹窗 */
    #country-detail {
        left: 50%;
        width: calc(100vw - 32px);
        max-width: none;
        max-height: 90vh;
        top: 50%;
    }
    
    .country-detail-header h2 {
        font-size: 2rem;
        padding-right: 40px;
    }
    
    .country-detail-content {
        padding: 20px;
        max-height: calc(90vh - 100px);
    }
    
    .country-image {
        height: 200px;
    }
    
    /* 语言切换按钮 */
    #language-switcher {
        top: 16px;
        right: 16px;
        z-index: 150;
    }
    
    /* 游戏模式按钮 */
    .game-mode-btn {
        bottom: 16px;
        right: 16px;
        font-size: 14px;
        padding: 10px 16px;
    }
    
    /* 游戏分数显示 */
    .game-score {
        bottom: 16px;
        right: 120px;
        font-size: 14px;
        padding: 10px 16px;
    }
    
    #score-value {
        font-size: 18px;
    }
    
    /* 游戏选项弹窗 - 移动端游戏模式下放在顶部，避免与语言切换按钮重叠 */
    .game-options {
        top: 70px !important;
        left: 50% !important;
        transform: translate(-50%, 0) scale(0.8) !important;
        width: calc(100vw - 32px);
        max-width: 400px;
        padding: 16px;
        max-height: min(420px, calc(100vh - 104px));
        overflow-y: auto;
    }
    
    .game-options.show {
        transform: translate(-50%, 0) scale(1) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* 游戏选项弹窗滚动条样式（移动端） */
    .game-options::-webkit-scrollbar {
        width: 6px;
    }
    
    .game-options::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 3px;
    }
    
    .game-options::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 3px;
    }
    
    /* Tab按钮字体调整 */
    .tab-btn {
        font-size: 12px;
        padding: 10px 6px;
    }
    
    /* 搜索框 */
    .search-container {
        padding: 12px 16px;
    }
    
    .search-input {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 14px 16px;
    }
    
    /* 排名列表项 */
    .rank-item {
        padding: 14px 20px;
        /* 增大触摸目标 */
        min-height: 48px;
    }
    
    .rank-num {
        font-size: 13px;
        width: 20px;
        margin-right: 10px;
    }
    
    .value-text {
        font-size: 12px;
    }
    
    /* 最终分数页面 */
    .final-score-content {
        padding: 32px 24px;
        margin: 16px;
        width: calc(100% - 32px);
        max-width: 400px;
    }
    
    .final-score-icon {
        font-size: 60px;
    }
    
    .final-score-title {
        font-size: 24px;
    }
    
    .final-score-number {
        font-size: 36px;
    }
    
    .final-score-record {
        max-width: none;
        margin-bottom: 20px;
        padding: 12px 14px;
    }
    
    .restart-game-btn,
    .exit-game-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .final-score-buttons {
        flex-direction: column;
        gap: 12px;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .country-detail-header h2 {
        font-size: 1.6rem;
    }
    
    .country-detail-content {
        padding: 16px;
    }
    
    .country-image {
        height: 160px;
    }
    
    /* .header-main h1 的字号由上面 @media (max-width: 768px) 的 clamp() 统一控制 */
    
    .tab-btn {
        font-size: 11px;
        padding: 8px 4px;
    }
    
    .game-score {
        right: 100px;
    }
    
    /* 小屏幕手机游戏选项弹窗进一步优化 */
    .game-options {
        top: 60px !important;
        padding: 14px;
        max-height: min(420px, calc(100vh - 88px));
        transform: translate(-50%, 0) scale(0.8) !important;
    }
    
    .game-options.show {
        transform: translate(-50%, 0) scale(1) !important;
    }
    
    .game-options-title {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    .game-option-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .final-score-content {
        padding: 24px 16px;
    }
    
    .final-score-icon {
        font-size: 50px;
    }
    
    .final-score-title {
        font-size: 20px;
    }
    
    .final-score-number {
        font-size: 32px;
    }
}

/* 移动端禁用hover效果，改用点击 */
@media (hover: none) and (pointer: coarse) {
    .country:hover {
        fill: #bcccdc;
        stroke: #fff;
        filter: none;
    }
    
    .rank-item:hover {
        background: transparent;
    }
    
    .tab-btn:hover {
        background: rgba(255,255,255,0.1);
        color: rgba(255,255,255,0.7);
    }
    
    .tab-btn.active:hover {
        background: rgba(255,255,255,0.25);
        color: #fff;
    }
}

/* 触摸设备优化 */
@media (pointer: coarse) {
    /* 增大触摸目标 */
    .lang-current,
    .lang-option {
        padding: 10px 18px;
        min-height: 44px;
    }
    
    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
    
    .game-option-btn {
        min-height: 48px;
        font-size: 16px;
    }
    
    .sidebar-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}

.country-detail-content {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.country-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
}

.country-gallery {
    position: relative;
    margin-bottom: 20px;
}

.country-gallery .country-image {
    margin-bottom: 0;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 26px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.gallery-nav.hidden {
    display: none;
}

.gallery-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    pointer-events: none;
}

/* 图片署名：Wikimedia Commons 的 CC BY / CC BY-SA 图片要求标注作者与许可。
   没有署名信息的国家整行隐藏，因此不影响既有国家的布局。 */
.gallery-credit {
    margin: -12px 2px 16px;
    font-size: 11px;
    line-height: 1.5;
    text-align: right;
    color: #8a8a8a;
}

.gallery-credit[hidden] {
    display: none;
}

.gallery-credit a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.25);
}

.gallery-credit a:hover {
    color: #2d3748;
}

.country-info h3 {
    color: #2d3748;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.country-info p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-line;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: none;
}

/* --- 语言切换按钮 --- */
#language-switcher {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* --- 语言切换（下拉选择器） --- */
.lang-dropdown {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #486581;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Yu Gothic", sans-serif;
}

.lang-current:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.lang-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s ease;
}

.lang-current[aria-expanded="true"] .lang-caret {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s ease;
    z-index: 110;
}

.lang-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    text-align: left;
    border: none;
    background: transparent;
    color: #486581;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.lang-option:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.lang-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* --- 搜索框样式 --- */
.search-container {
    position: relative;
    padding: 16px 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #102a43;
    font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.search-input::placeholder {
    color: #829ab1;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 100;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: block;
    width: 100%;
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s;
    font-size: 15px;
    color: #102a43;
    font-family: inherit;
    text-align: left;
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-sizing: border-box;
}

.search-result-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.search-result-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.search-result-item:hover,
.search-result-item.active {
    background: rgba(102, 126, 234, 0.1);
}

.search-result-item:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

.search-result-empty {
    color: #829ab1;
    cursor: default;
}

.search-result-item .highlight {
    font-weight: 700;
    color: #667eea;
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 12px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #9fb3c8;
}

/* --- 从 Tailwind output.css 提取的工具类 --- */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 1.2;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5;
}

.font-black {
    font-weight: 900;
}

.font-bold {
    font-weight: 700;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

.text-slate-700 {
    color: #334e68;
}

.text-slate-800 {
    color: #1e293b;
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 0.15s;
}

/* group-hover 效果 */
.group:hover .group-hover\:text-blue-700 {
    color: #1d4ed8;
}

/* --- 游戏模式样式 --- */
.game-mode-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.game-mode-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(240, 147, 251, 0.5);
}

.game-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 游戏分数 */
.game-score {
    position: fixed;
    bottom: 24px;
    right: 180px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.game-score.show {
    display: flex;
}

#score-value {
    font-size: 20px;
    color: #f5576c;
}

/* 游戏选项弹窗 */
.game-options {
    position: fixed;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
}

.game-options.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.game-options-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #334e68;
    margin-bottom: 20px;
}

.game-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-option-btn {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.game-option-btn:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.game-option-btn.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse-correct 0.5s ease;
}

.game-option-btn.wrong {
    background: linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%);
    animation: shake 0.5s ease;
}

@keyframes pulse-correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* 游戏结果效果 */
.game-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 400;
    pointer-events: none;
    opacity: 0;
}

.game-result.show {
    animation: result-pop 1s ease forwards;
}

.game-result .result-icon {
    font-size: 120px;
    display: block;
}

.game-result.correct .result-icon::before {
    content: '🎉';
}

.game-result.wrong .result-icon::before {
    content: '❌';
}

@keyframes result-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    50% { transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* 缩放时禁用country和标签的transition以避免闪烁 */
body.zooming .country {
    transition: none !important;
}

body.zooming .country-label {
    transition: none !important;
}

/* 游戏模式下隐藏国家标签 */
body.game-mode .country-label {
    opacity: 0 !important;
}

/* 地图移动时禁用国家hover效果，避免闪烁 */
.country.no-hover,
.country.no-hover:hover {
    fill: #bcccdc !important;
    stroke: #fff !important;
    filter: none !important;
    cursor: default !important;
    transition: none !important;
}

body.map-animating .country {
    transition: none !important;
}

body.map-animating .country:hover {
    fill: #bcccdc !important;
    stroke: #fff !important;
    filter: none !important;
    cursor: default !important;
    transition: none !important;
}

/* 地图移动时完全隐藏标签，避免闪烁 */
body.map-animating .country-label {
    opacity: 0 !important;
    transition: none !important;
}

/* 游戏模式下禁用侧边栏展开 */
body.game-mode .sidebar-toggle {
    display: none !important;
}

body.game-mode .country.game-target {
    fill: #ffd700;
    stroke: #ff8c00;
    stroke-width: 2px;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
    animation: target-pulse 1.5s ease-in-out infinite;
}

@keyframes target-pulse {
    0%, 100% { filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6)); }
    50% { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.9)); }
}

/* 游戏结束分数页面 */
.final-score {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.final-score.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.final-score-content {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px;
    text-align: center;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.final-score-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

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

.final-score-title {
    font-size: 28px;
    font-weight: 700;
    color: #334e68;
    margin: 0 0 20px 0;
}

.final-score-number {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 32px;
}

/* 本机成绩记录（历史最佳 / 最长连对 / 最近几局），数据只在用户浏览器里 */
.final-score-record {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 260px;
    margin: 0 auto 28px;
    padding: 14px 18px;
    background: rgba(102, 126, 234, 0.07);
    border: 1px solid rgba(102, 126, 234, 0.16);
    border-radius: 14px;
}

/* 存储不可用（隐私模式等）或尚无记录时整块隐藏 */
.final-score-record[hidden] {
    display: none;
}

.record-new {
    align-self: center;
    margin-bottom: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(246, 173, 85, 0.2);
    color: #975a16;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.record-new[hidden] {
    display: none;
}

.record-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #486581;
}

.record-label {
    text-align: left;
}

.record-value {
    font-weight: 700;
    color: #334e68;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.final-score-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.restart-game-btn,
.exit-game-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.restart-game-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.restart-game-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(240, 147, 251, 0.5);
}

.exit-game-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.exit-game-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

/* 修改前：会导致无法点击 */
/* body.is-zooming .country {
    pointer-events: none !important; 
    transition: none !important;
} */

/* 修改后：可以点击，且保留防闪烁优化 */
body.is-zooming .country {
    /* 删掉了 pointer-events: none，现在鼠标可以点击了 */
    
    /* 保留这个，它能解决“地图移动时颜色乱闪”的问题 */
    transition: none !important;
}

body.is-zooming .country-label {
    /* 这一行可以保留，拖拽时让文字不响应鼠标，提高流畅度 */
    pointer-events: none !important;
    transition: none !important;
}

/* 缩放/拖拽过程中：整层隐藏标签。
   205 个带 text-shadow 的文字每帧重绘代价很高，且缩放中标签本来就该让位给地图，
   缩放结束（body 去掉 is-zooming）时由 updateLabels() 一次性刷新字号与可见性。 */
/* 缩放/拖拽手势期间标签层只禁鼠标、不隐藏：
   字号与可见性本来就在手势期间冻结（updateLabels 跳过），
   205 个文本的光栅化远比国家路径便宜，实测隐藏与否帧率无差异。
   （此前 is-zooming 时 display:none，导致按住拖动时国家名全部消失） */
body.is-zooming #layer-labels {
    pointer-events: none;
}

/* 缩放过程中关闭抗锯齿：17 万+ 坐标点的路径抗锯齿光栅化是掉帧主因之一，
   缩放结束后自动恢复平滑渲染（shape-rendering 默认值）。 */
body.is-zooming #layer-map {
    shape-rendering: optimizeSpeed;
}

/* 缩放过程中去掉描边：每个国家的描边都要逐段绘制 17 万条线段，
   去掉后光栅化成本约减半（实测 p90 帧耗时 13.9ms → 7ms）。
   只在放大倍数较小时降级（.low-zoom），此时国家密集、描边最贵；
   放大后可见国家只剩几个，描边成本可忽略，保留边界线视觉更好。 */
body.is-zooming.low-zoom .country {
    stroke: none !important;
}

/* --- 修复手机缩放闪烁的新代码 --- */

/* 当地图正在缩放时，强制移除所有滤镜效果 */
body.is-zooming .country {
    filter: none !important;
}

/* 即使是游戏目标，在缩放过程中也不要显示阴影，等缩放完了再显示 */
body.is-zooming .country.game-target {
    filter: none !important;
    animation: none !important; /* 暂停跳动动画，节省性能 */
}

/* 说明：部分环境（特定 Chromium/GPU 组合）缩放动画后 CSS transition 会冻结，
   导致 .country:hover 变色卡在起始值（鼠标悬停国家不变色）。
   修复在 js/main.js 的 scheduleHoverFallback()：hover 450ms 后 fill 仍未到达
   目标色时，对该元素内联禁用 transition，使 :hover 样式瞬时生效。 */


/* ============ 无障碍（a11y） ============ */

/* 焦点环：全站统一。此前只有 .tab-btn / .about-link / .search-result-item 有，
   语言下拉、关闭按钮、图库翻页、竞猜按钮、侧边栏开关等键盘可达的控件全都看不见焦点。
   用 :focus-visible（而非 :focus）保证鼠标点击不出现焦点环。 */
.lang-current:focus-visible,
.lang-option:focus-visible,
.close-btn:focus-visible,
.gallery-nav:focus-visible,
.sidebar-toggle:focus-visible,
.game-mode-btn:focus-visible,
.game-option-btn:focus-visible,
.restart-game-btn:focus-visible,
.exit-game-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 8px;
}

/* 榜单行是可点/可键盘操作的按钮（原先是 div + onclick，键盘与读屏都到不了）：
   重置按钮默认样式，保持与原 div 版一致的布局与外观。 */
button.rank-item {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    margin: 0;
    border: 0;
    border-bottom: 1px solid rgba(0,0,0,0.02);
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
}

.rank-item:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: -3px;
    background: rgba(255, 255, 255, 0.95);
}

/* 减少动态效果：地图缩放动画（JS 侧由 main.js 读同一个 media query 把时长设为 0）、
   榜单入场与进度条过渡、面板抽屉等一律去掉。
   注意：进度条宽度仍由 JS 设置，只是不再有过渡过程，功能不受影响。 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
}
