* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Segoe UI", sans-serif; }
body { overflow: hidden; background: #f5f7fa; }
#map { width: 100vw; height: 100vh; }
/* 在线人数面板（点击整个区域可展开） */
#online-panel { 
    position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; 
    background: rgba(255, 255, 255, 0.95); 
    padding: 12px 20px; 
    border-radius: 20px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); 
    font-size: 14px; 
    cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: all 0.3s ease;
    width: auto; /* 自适应宽度 */
}
#online-panel:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateX(-50%) translateY(-2px);
}
#online-title { 
    font-weight: 600; color: #333; margin: 0; 
    display: flex; align-items: center; gap: 4px;
}
/* 去掉三角形图标 */
#online-title::after {
    content: "";
}
/* 在线用户列表（优化大小和排版） */
#online-user-list {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(-10px);
    background: rgba(255, 255, 255, 0.98); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px 0; min-width: 220px; max-height: 300px; /* 限制最大高度，避免占满屏幕 */
    overflow-y: auto; 
    display: none; opacity: 0; transition: all 0.3s ease;
    z-index: 1001;
}
#online-panel.expanded #online-user-list {
    display: block; opacity: 1; transform: translateX(-50%) translateY(5px);
}
.list-group-header {
    padding: 4px 16px; font-size: 12px; font-weight: 600; color: #718096;
    border-bottom: 1px solid #f0f0f0;
}
.online-user { 
    padding: 8px 16px; 
    font-size: 13px; cursor: pointer; color: #333;
    display: flex; align-items: center; gap: 8px; transition: background 0.2s ease;
}
.online-user:hover { 
    color: #4285F4; background: #f5f9ff; 
}
.online-user.self { 
    color: #4285F4; font-weight: 600; 
}
.user-avatar-mini {
    width: 24px; height: 24px; border-radius: 50% !important; 
    object-fit: cover; border: 1px solid #e2e8f0;
}
/* 头像选择按钮（右上角） */
#avatar-select-btn {
    position: fixed; top: 10px; right: 10px; z-index: 1000;
    width: 44px; height: 44px; border-radius: 50% !important;
    background: white; border: 2px solid #4285F4;
    cursor: pointer; overflow: hidden;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
}
#avatar-select-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.2);
}
#current-avatar {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50% !important;
}
/* 头像选择菜单（缩小尺寸） */
#avatar-menu {
    position: fixed; top: 64px; right: 10px; z-index: 1000;
    background: white; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 12px; min-width: 160px; display: none;
    opacity: 0; transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#avatar-menu.show {
    display: block; opacity: 1; transform: translateY(0) scale(1);
}
.menu-header {
    font-size: 14px; font-weight: 600; color: #2d3748; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid #f0f0f0;
}
.avatar-options {
    display: flex; gap: 8px; margin-bottom: 12px;
}
.avatar-option {
    width: 40px; height: 40px; border-radius: 50% !important;
    border: 2px solid #e2e8f0; cursor: pointer; overflow: hidden;
    transition: all 0.2s ease;
}
.avatar-option:hover {
    transform: scale(1.1); border-color: #4285F4;
}
.avatar-option.selected {
    border-color: #4285F4; box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}
.avatar-img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50% !important;
}
/* 透明度拉条容器 */
.opacity-control {
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.opacity-control label {
    font-size: 12px;
    color: #718096;
}
#popup-opacity {
    width: 100%;
    cursor: pointer;
}
/* 名字输入框 */
.name-input-container {
    margin-bottom: 12px;
}
#name-input {
    width: 100%; padding: 6px 10px; border: 1px solid #e2e8f0;
    border-radius: 8px; font-size: 12px; color: #2d3748;
    transition: all 0.3s ease;
}
#name-input:focus {
    outline: none; border-color: #4285F4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}
.name-hint {
    font-size: 11px; color: #718096; margin-top: 4px;
}
/* 保存按钮 */
#save-settings-btn {
    width: 100%; padding: 6px 0; background: linear-gradient(135deg, #4285F4, #34A853);
    color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
#save-settings-btn:hover {
    opacity: 0.9; transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(66, 133, 244, 0.2);
}
/* 弹窗样式（优化与头像间距） */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    transform: none !important;
    width: 220px !important;
    max-width: 220px !important;
    opacity: 0.9 !important;
}
.user-popup {
    width: 220px !important;
    max-width: 220px !important;
    line-height: 1.5; font-size: 12px; padding: 8px 0;
}
.popup-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.popup-avatar {
    width: 32px; height: 32px; border-radius: 50% !important; 
    object-fit: cover; border: 1px solid #e2e8f0;
}
.popup-name {
    font-weight: 600; color: #2d3748;
}
.popup-role {
    font-size: 11px; color: #718096; 
    background: #f0f7ff; padding: 1px 6px; border-radius: 10px; margin-left: 4px;
}
.popup-info {
    color: #4a5568; font-size: 11px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 200px;
    flex-wrap: nowrap;
}
.toggle-btn {
    font-size: 10px;
    padding: 1px 4px;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}
.toggle-btn:hover {
    background: #4285F4;
    color: white;
}
.hide-text { color: #a0aec0; }
/* 修复弹窗关闭按钮 */
.leaflet-popup-close-button {
    display: block !important; top: 5px !important; right: 5px !important;
    font-size: 16px !important; color: #718096 !important;
    background: white !important; border-radius: 50% !important;
    width: 20px !important; height: 20px !important; line-height: 20px !important;
    text-align: center !important; padding: 0 !important;
}
.leaflet-popup-close-button:hover {
    color: #2d3748 !important; background: #f5f5f5 !important;
}
/* 雷达光效（匹配GIF：持续扫描） */
@keyframes radarScan {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(2); /* 扩散范围 */
        opacity: 0;
    }
}
.radar-marker {
    position: relative;
}
.radar-circle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    animation: radarScan 2s infinite ease-out;
    pointer-events: none;
}
/* 地图标记头像改为圆形 */
.radar-marker img {
    border-radius: 50% !important;
    object-fit: cover !important;
}
/* 自定义成功提示 */
.success-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999;
    background: #34A853; color: white; padding: 8px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 500; box-shadow: 0 4px 12px rgba(52, 168, 83, 0.3);
    opacity: 0; transition: opacity 0.3s ease;
}
.success-toast.show {
    opacity: 1;
}
