/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 统一的边距变量 */
:root {
    --edge-spacing: 16px;  /* 统一的边缘间距 */
    --control-gap: 10px;   /* 控件之间的间距 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

/* 统一所有按钮和控件的字体 */
button, input, select, textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* 统一所有按钮和可点击元素的光标 */
button, a, .clickable {
    cursor: pointer;
}

button:disabled, input:disabled {
    cursor: not-allowed;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 地图全屏 */
#map {
    width: 100%;
    height: 100%;
}

/* Google Maps 风格的鼠标光标 */
#map canvas {
    cursor: default;
}

#map.dragging canvas {
    cursor: move !important;
}

/* 标记和可交互元素上使用 pointer */
.mapboxgl-marker {
    cursor: pointer !important;
}

/* 地区选择器独立按钮 */
.region-selector-standalone {
    position: absolute;
    top: var(--edge-spacing);
    left: calc(var(--edge-spacing) + 320px + 8px);
    z-index: 1001;
}

.region-selector-standalone .region-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    padding: 2px;
}

.region-selector-standalone .region-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

/* 功能按钮 */
.function-btn {
    height: 36px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.function-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.function-btn .material-icons {
    font-size: 18px;
    color: #5f6368;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.function-btn-text {
    font-size: 13px;
    color: #202124;
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 功能按钮激活状态 - 只改变文字和图标颜色 */
.function-btn.active .function-btn-text {
    color: #1a73e8;
}

/* 功能按钮激活时图标变为蓝色 - 与登入按钮保持一致 */
.function-btn.active .material-icons {
    color: #1a73e8;
}

/* 点击动画 - 内圈蓝色填充 */
.function-btn.clicked {
    animation: btnPressInner 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes btnPressInner {
    0% {
        box-shadow: 0 1px 4px rgba(0,0,0,0.3);
        border: 1px solid #dadce0;
    }
    50% {
        box-shadow: inset 0 0 0 2px #1a73e8, 
                    inset 0 0 8px rgba(26, 115, 232, 0.4);
        border: 1px solid #1a73e8;
    }
    100% {
        box-shadow: 0 1px 4px rgba(0,0,0,0.3);
        border: 1px solid #dadce0;
    }
}

/* 激活状态 - 内圈蓝色填充 */
.function-btn.active {
    box-shadow: inset 0 0 0 2px #1a73e8, 
                inset 0 0 6px rgba(26, 115, 232, 0.3);
    border: 1px solid #1a73e8;
}

/* 右上角按钮组 */
.top-right-buttons {
    position: absolute;
    top: var(--edge-spacing);
    right: var(--edge-spacing);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* PC端隐藏移动端spacer */
.top-right-buttons .mobile-spacer {
    display: none;
}

/* 功能菜单下拉容器 */
.function-menu-dropdown {
    position: relative;
}

/* 三横线按钮 - 默认圆形，展开后胶囊形 */
.menu-toggle {
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.menu-toggle:hover {
    background: #f5f5f5;
}

.menu-toggle .material-icons {
    width: 28px;
    height: 28px;
    font-size: 20px;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 三横线按钮激活状态 - 当有功能按钮被激活时，蓝色背景+白色图标 */
.menu-toggle.has-active {
    background: #1a73e8;
    border-color: #1a73e8;
}

.menu-toggle.has-active .material-icons {
    color: white;
}

/* 展开状态 - 菜单按钮保持圆形不变 */

/* 功能菜单（向下弹出，胶囊式按钮） */
.function-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.function-menu-dropdown.open .function-menu {
    display: flex;
}

/* 功能菜单项 - 胶囊式按钮，统一宽度 */
.function-menu-item {
    width: 120px;
    height: 36px;
    padding: 0 12px 0 4px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
}

.function-menu-item:hover {
    border-color: #34c759;
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

.function-menu-item.active {
    box-shadow: inset 0 0 0 2px #1a73e8, 
                inset 0 0 6px rgba(26, 115, 232, 0.3);
    border-color: #1a73e8;
}

.function-menu-item .material-icons {
    width: 28px;
    height: 28px;
    font-size: 18px;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.function-menu-item.active .material-icons {
    color: #1a73e8;
}

.function-menu-text {
    font-size: 14px;
    font-weight: 400;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* 功能菜单项点击动画 */
.function-menu-item.clicked {
    animation: menuItemPress 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menuItemPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* 语言切换开关 */
.lang-switcher {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
    cursor: pointer;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    padding: 0 2px;
    transition: all 0.2s;
}

.lang-switcher:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.lang-option {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lang-option-cn {
    z-index: 2;
}

.lang-option-gb {
    margin-left: -8px;
    z-index: 1;
}

.lang-flag {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    transition: all 0.3s ease;
    filter: grayscale(100%) opacity(0.4);
    position: absolute;
}

.lang-option.active .lang-flag {
    filter: grayscale(0%) opacity(1);
}

.lang-text {
    position: relative;
    z-index: 3;
    font-size: 10px;
    font-weight: 400;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    pointer-events: none;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.lang-option:not(.active) .lang-text {
    color: #999;
    text-shadow: none;
}

/* Google Apps 按钮 */
.apps-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.apps-btn:hover {
    background: rgba(0,0,0,0.05);
}

.apps-btn .material-icons {
    font-size: 24px;
    color: #5f6368;
}

/* 登录后蓝色样式 */
.apps-btn.logged-in .material-icons {
    color: #1a73e8;
}

/* 地图语言下拉菜单 */
.map-lang-dropdown {
    position: relative;
}

.map-lang-btn {
    height: 36px;
    width: 70px;
    padding: 0 2px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.map-lang-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.map-lang-btn-flag {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.map-lang-btn-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.map-lang-dropdown.open .map-lang-menu {
    display: flex;
}

.map-lang-option {
    height: 36px;
    width: 70px;
    padding: 0 2px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    position: relative;
}

.map-lang-option:hover {
    border-color: #34c759;
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

/* 移除 active 状态的蓝色边框，只在悬停时显示绿色边框 */

.map-lang-flag {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.map-lang-option-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-lang-check {
    display: none;
}

/* 登入按钮 - 未登录状态：白色背景 */
.login-btn {
    height: 36px;
    width: 90px;
    padding: 0;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

/* 搜索框 */
.search-container {
    position: absolute;
    top: var(--edge-spacing);
    left: var(--edge-spacing);
    z-index: 1000;
    width: 320px;
    max-width: calc(100% - var(--edge-spacing) * 2 - 40px - 8px);
    overflow: visible;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    padding: 0 6px 0 12px;
    gap: 8px;
    overflow: visible;
}

.search-icon {
    font-size: 20px;
    color: #5f6368;
}

#search-input {
    flex: 1;
    padding: 11px 0;
    border: none;
    font-size: 14px;
    outline: none;
    color: #202124;
}

#search-input::placeholder {
    color: #70757a;
}

#search-input:disabled {
    background: white;
    cursor: not-allowed;
}

/* 清空搜索按钮 */
.clear-search-btn {
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    margin-right: -4px;
}

.clear-search-btn .material-icons {
    font-size: 16px;
    color: #9aa0a6;
}

.clear-search-btn:hover .material-icons {
    color: #5f6368;
}

.random-address-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.random-address-btn:hover {
    background: #f8f9fa;
}

.random-address-btn .material-icons {
    font-size: 20px;
    color: #5f6368;
    transition: color 0.2s;
}

.random-address-btn:hover .material-icons {
    color: #1a73e8;
}

/* 骰子旋转动画 */
.random-address-btn.spinning .material-icons {
    animation: dice-spin 0.6s ease-in-out;
}

@keyframes dice-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.region-icon {
    font-size: 20px;
    color: #5f6368;
    pointer-events: none;
}

.region-flag {
    font-size: 22px;
    pointer-events: none;
}

.region-flag-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
}

/* 搜索建议 */
.suggestions-list {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px 0;
}

.suggestions-list.show {
    display: block;
}

.suggestion-item {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e8eaed;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-main {
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
}

.suggestion-secondary {
    font-size: 12px;
    color: #70757a;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin-top: 2px;
    line-height: 1.4;
}

/* 右侧控制按钮组 - 垂直居中 */
.control-btn {
    position: fixed !important;
    right: var(--edge-spacing) !important;
    z-index: 1000 !important;
    width: 40px !important;
    height: 40px !important;
    background: white !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
}

.control-btn:hover {
    background: #f5f5f5 !important;
}

.control-btn.active {
    background: #1a73e8 !important;
}

.control-btn .material-icons {
    font-size: 20px !important;
    color: #5f6368 !important;
}

.control-btn.active .material-icons {
    color: white !important;
}

/* 缩放控制 - 最上方，居中偏上 */
.zoom-controls {
    position: fixed !important;
    top: 50% !important;
    right: var(--edge-spacing) !important;
    transform: translateY(-50%) translateY(-80px) !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--control-gap) !important;
}

.zoom-btn {
    width: 40px !important;
    height: 40px !important;
    background: white !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
}

.zoom-btn:hover {
    background: #f5f5f5 !important;
}

.zoom-btn .material-icons {
    font-size: 20px !important;
    color: #5f6368 !important;
}

/* 定位按钮 - 缩放按钮下方 */
#locate-btn {
    top: 50% !important;
    transform: translateY(-50%) translateY(30px) !important;
    bottom: auto !important;
}

/* 3D 按钮 */
#toggle-3d-btn {
    top: 50% !important;
    transform: translateY(-50%) translateY(80px) !important;
    bottom: auto !important;
}

/* 重置视角按钮 - 最下方 */
#reset-view-btn {
    top: 50% !important;
    transform: translateY(-50%) translateY(130px) !important;
    bottom: auto !important;
}

/* 底部信息栏 */
.bottom-info-bar {
    position: fixed !important;
    bottom: var(--edge-spacing) !important;
    right: var(--edge-spacing) !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center;
    gap: var(--control-gap);
}

/* 比例尺容器 */
.scale-container {
    background: white;
    border-radius: 50px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 40px;
    box-sizing: border-box;
    font-size: 13px;
    color: #202124;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* 经纬度显示 */
.coordinates-display {
    background: white;
    border-radius: 50px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #202124;
    width: 230px;
    height: 40px;
    box-sizing: border-box;
}

.coordinates-display .material-icons {
    font-size: 18px;
    color: #5f6368;
    flex-shrink: 0;
}

#coordinates-text {
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    text-align: center;
}

/* 图层选择器 */
.layer-selector {
    position: absolute !important;
    bottom: var(--edge-spacing) !important;
    left: var(--edge-spacing) !important;
    z-index: 800 !important;
}

.layer-btn-main {
    background: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    padding: 6px 12px 6px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.layer-btn-main:hover {
    background: #f5f5f5;
}

.layer-btn-preview {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layer-btn-preview .material-icons {
    font-size: 20px;
    color: #5f6368;
}

.layer-btn-name {
    font-size: 14px;
    color: #5f6368;
    font-weight: 500;
    white-space: nowrap;
}

/* 图层菜单 */
.layer-menu {
    position: absolute;
    bottom: 0;
    left: 100%;
    margin-left: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    padding: 10px;
    display: none;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* 图层菜单展开状态 */
.layer-menu.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.layer-option {
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    padding: 0;
    border-radius: 8px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.layer-option:hover .layer-preview {
    transform: scale(1.02);
}

.layer-preview {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.layer-option.active .layer-preview {
    box-shadow: 0 0 0 2px #1a73e8;
}

.layer-preview .material-icons {
    font-size: 20px;
    color: #5f6368;
}

.layer-name {
    font-size: 12px;
    color: #5f6368;
    font-weight: 400;
    white-space: nowrap;
    padding-bottom: 2px;
}

.layer-option.active .layer-name {
    color: #1a73e8;
    font-weight: 500;
}

/* 地址详情卡片 - Google Maps 精确风格 */
.detail-card {
    position: fixed;
    bottom: var(--edge-spacing);
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + var(--edge-spacing)));
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 2px 6px 2px rgba(60,64,67,0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 900;
    width: 380px;
    max-width: calc(100vw - var(--edge-spacing) * 2);
}

.detail-card.show {
    transform: translateX(-50%) translateY(0);
}

/* 关闭按钮 - Google Maps 风格 */
.card-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    z-index: 2;
    padding: 0;
    opacity: 0.6;
}

.card-close-btn:hover {
    opacity: 1;
}

.card-close-btn .material-icons {
    font-size: 20px;
    color: #70757a;
    font-weight: 400;
}

/* 卡片内容 */
.card-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    padding-right: 44px;
}

/* 左侧地图图标 */
.card-map-icon {
    flex-shrink: 0;
}

.card-map-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* 中间地址信息 */
.card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-address {
    font-size: 16px;
    font-weight: 400;
    color: #202124;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.card-region {
    font-size: 14px;
    color: #5f6368;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e8eaed;
}

.card-coords {
    font-size: 13px;
    color: #1a73e8;
    line-height: 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

/* 右侧导航图标 */
.card-directions-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid #1a73e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}

.card-directions-icon:hover,
.card-directions-icon:active {
    background: #1a73e8;
}

.card-directions-icon .material-icons {
    font-size: 20px;
    color: #1a73e8;
    transition: color 0.2s;
}

.card-directions-icon:hover .material-icons,
.card-directions-icon:active .material-icons {
    color: white;
}

/* 右侧国旗图标 */
.card-flag-icon {
    flex-shrink: 0;
}

.card-flag-icon img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    box-sizing: border-box;
    display: block;
}



/* 地区选择面板 */
.region-panel {
    position: fixed;
    top: var(--edge-spacing);
    left: calc(var(--edge-spacing) + 320px + 8px + 44px + 8px);
    z-index: 2000;
    display: none;
    flex-direction: column;
    gap: 8px;
    max-width: 560px;
}

.region-panel.show {
    display: flex;
}

.region-panel-overlay {
    display: none;
}

.region-panel-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 大洲行 */
.continent-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.continent-option {
    height: 40px;
    width: 80px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #202124;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
    outline: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.continent-option:hover {
    border-color: #34c759;
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

.continent-option.active {
    border-color: #34c759;
    background: white;
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

/* 国家行 */
.country-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.country-card {
    height: 40px;
    width: 80px;
    padding: 1px 8px 1px 1px;
    border: 2px solid transparent;
    border-radius: 50px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    font-size: 12px;
    font-weight: 500;
    color: #202124;
    flex-shrink: 0;
}

.country-card:hover {
    border-color: #34c759;
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

.country-flag {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.05);
}

.country-code {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    flex: 1;
}

/* 隐藏 Mapbox 原生控件 */
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib {
    display: none !important;
}

/* 原生 Tooltip 已使用浏览器默认样式，无需自定义CSS */

/* 国家卡片悬停提示 */
.country-card {
    position: relative;
}

.country-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(60, 64, 67, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 300;
    z-index: 10002;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    white-space: nowrap;
    text-align: center;
}

.country-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式 */
@media (max-width: 768px) {
    .search-container {
        left: 50px;
        width: calc(100% - 60px);
    }
    
    .layer-selector {
        bottom: 10px;
        left: 10px;
    }
    
    #reset-view-btn {
        bottom: 10px;
    }
    
    #toggle-3d-btn {
        bottom: 60px;
    }
    
    #locate-btn {
        bottom: 110px;
    }
    
    .zoom-controls {
        bottom: 160px;
    }
    
    .country-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .country-modal-body {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .continent-menu {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Toast 提示 - 底部中央显示，符合 Google Maps 设计习惯 */
.toast {
    position: fixed;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #202124;
    padding: 0 18px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast:not(.show) {
    transform: translateX(-50%) translateY(20px);
}

.toast.success {
    background: white;
    color: #202124;
}

.toast.error {
    background: white;
    color: #ff3b30;
}

.toast.info {
    background: white;
    color: #202124;
}

/* IBAN不支持警告提示 */
.toast.iban-warning {
    background: white;
    color: #d93025;
    font-weight: 500;
}

/* 加载动画 */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1500;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Google Maps 风格的自定义标记 */
.custom-marker {
    position: relative;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 标记主体 - 蓝色圆点 */
.marker-pin {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #4285f4;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 标记中心点 - 白色小圆点 */
.marker-center {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

/* 脉冲光晕效果 */
.marker-pulse {
    position: absolute;
    width: 18px;
    height: 18px;
    background: rgba(66, 133, 244, 0.3);
    border-radius: 50%;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* 功能面板堆叠容器 - CSS Flexbox 自动布局 */
.panels-stack {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

/* 堆叠面板通用样式 */
.panels-stack > .stack-panel {
    display: none;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
}

.panels-stack > .stack-panel.show,
.panels-stack > .stack-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 地址详情面板 */
.address-detail-panel {
    padding: 8px 12px;
}

/* .address-detail-panel.show 继承 stack-panel 的显示样式 */

/* 地址行 */
.address-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.address-row:not(:last-child) {
    border-bottom: 1px solid #e8eaed;
}

/* 地址图标 */
.address-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.address-icon svg {
    width: 16px;
    height: 16px;
}

/* 有数据时图标变蓝 */
.address-row.has-data .address-icon svg {
    stroke: #1a73e8 !important;
}

.address-row.has-data .address-icon svg path {
    stroke: #1a73e8 !important;
}

/* 地址内容 */
.address-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.address-label {
    font-size: 12px;
    color: #70757a;
    font-weight: 400;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.address-value {
    font-size: 13px;
    color: #202124;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 复制按钮 */
.address-copy-btn {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    opacity: 0.6;
}

.address-copy-btn:hover {
    background: #f8f9fa;
    opacity: 1;
}

.address-copy-btn .material-icons {
    font-size: 14px;
    color: #5f6368;
    transition: all 0.3s;
}

/* 复制成功状态 */
.address-copy-btn.copied {
    background: #34c759;
    opacity: 1;
}

.address-copy-btn.copied .material-icons {
    color: white;
    animation: copySuccess 0.3s ease-in-out;
}

/* 复制失败状态 */
.address-copy-btn.copy-error {
    background: #ff3b30;
    opacity: 1;
}

.address-copy-btn.copy-error .material-icons {
    color: white;
    animation: copyError 0.3s ease-in-out;
}

/* 复制成功动画 */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* 复制失败动画 */
@keyframes copyError {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
    }
}



/* ========================================
   移动端适配 (≤ 768px)
   - 仅适用于手机端
   - PC端和平板保持现有UI
   - 分屏布局：上半部分面板区域，下半部分地图+控制按钮
   ======================================== */
@media (max-width: 768px) {
    /* === 隐藏元素 === */
    /* 底部信息栏 */
    .bottom-info-bar {
        display: none !important;
    }
    
    /* 右侧控制按钮 */
    .zoom-controls,
    #locate-btn,
    #toggle-3d-btn,
    #reset-view-btn {
        display: none !important;
    }
    
    /* 图层选择器 */
    .layer-selector {
        display: none !important;
    }
    
    /* 地区选择器 */
    .region-selector-standalone {
        display: none !important;
    }
    
    /* 地区选择面板 */
    .region-panel {
        display: none !important;
    }
    
    /* 用户面板容器（9点按钮）- 移动端保留显示，用于登录后访问点数和退出 */
    /* .user-panel-container 不再隐藏 */
    
    /* 地址详情卡片（底部弹出卡片）在移动端隐藏 */
    .detail-card {
        display: none !important;
    }
    
    /* === 分屏布局 === */
    /* 上半部分：面板区域（由JS动态创建的容器） */
    /* 最大高度32vh，地址生成+虚拟人物面板可完全显示，地图占68% */
    .mobile-panel-area {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: auto;
        max-height: 31vh;
        background: #f5f5f5;
        z-index: 1000;
        padding: 16px;
        overflow-y: auto;
        display: none;
        flex-direction: column;
        gap: 8px;
        box-sizing: border-box;
    }
    
    .mobile-panel-area.show {
        display: flex;
    }
    
    /* 面板区域内的面板强制使用静态定位，确保参与flex布局 */
    .mobile-panel-area > * {
        position: static !important;
        flex-shrink: 0;
    }
    
    /* 下半部分：地图区域 - 由JS动态设置top值 */
    body.mobile-split-view #map {
        position: fixed;
        left: 0;
        width: 100%;
        /* top 和 height 由 JS 动态计算 */
    }
    
    /* 默认状态：地图全屏 */
    #map {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transition: top 0.3s ease, height 0.3s ease;
    }
    
    /* === 地图区域内的控制元素 === */
    /* 搜索框 - 在地图区域内 */
    .search-container {
        position: fixed;
        left: var(--edge-spacing);
        right: var(--edge-spacing);
        width: auto;
        max-width: none;
        z-index: 1002;
        transition: top 0.3s ease;
    }
    
    /* 默认状态：搜索框在顶部 */
    .search-container {
        top: var(--edge-spacing);
    }
    
    /* 分屏时：搜索框位置由JS动态设置 */
    body.mobile-split-view .search-container {
        /* top 由 JS 动态计算 */
    }
    
    /* 隐藏原来的面板堆叠容器（面板会被移动到mobile-panel-area） */
    .search-container .panels-stack {
        display: none !important;
    }
    
    /* 右上角按钮组 - 在地图区域内 */
    .top-right-buttons {
        position: fixed;
        left: var(--edge-spacing);
        right: var(--edge-spacing);
        display: flex;
        justify-content: flex-start;
        gap: 8px;
        z-index: 1001;
        transition: top 0.3s ease;
    }
    
    /* 默认状态：按钮在搜索框下方 */
    .top-right-buttons {
        top: calc(var(--edge-spacing) + 44px + 10px);
    }
    
    /* 分屏时：按钮位置由JS动态设置 */
    body.mobile-split-view .top-right-buttons {
        /* top 由 JS 动态计算 */
    }
    
    /* === 面板区域内的面板样式 === */
    .mobile-panel-area .stack-panel {
        background: white;
        border-radius: 12px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
        margin-bottom: 0;
    }
    
    .mobile-panel-area .stack-panel.show,
    .mobile-panel-area .stack-panel.active {
        display: block;
    }
    
    /* 地址详情面板在移动端的样式 */
    .mobile-panel-area .address-detail-panel {
        border-radius: 12px;
        padding: 10px 14px;
        background: white;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    
    .mobile-panel-area .address-label {
        font-size: 11px;
    }
    
    .mobile-panel-area .address-value {
        font-size: 12px;
    }
    
    /* Toast 提示位置调整 */
    .toast {
        bottom: 50%;
        transform: translateX(-50%) translateY(50%);
    }
    
    body.mobile-split-view .toast {
        bottom: 25vh;
        transform: translateX(-50%);
    }
    
    /* 功能菜单下拉在移动端的调整 */
    .function-menu-dropdown.open .function-menu {
        right: auto;
        left: 0;
    }
}
