        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: Arial, sans-serif;
        }

        body {
            position: relative;
            height: 100vh;
            overflow: hidden;
        }

        #map {
            width: 100%;
            height: 100%;
        }

        .controls {
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: 1000;
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
            min-width: 280px;
            max-width: 320px;
            border: 1px solid rgba(255, 255, 255, 0.9);
            /* 新增：限制最大高度，让内容自己滚动 */
            max-height: calc(100vh - 30px);
            /* 上下留边 */
            display: flex;
            flex-direction: column;
            max-height: calc(100vh - 20px);
        }


        .control-header {
            flex: 0 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .control-header h3 {
            font-size: 16px;
            color: #333;
            font-weight: 500;
        }

        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 20px;
            cursor: pointer;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 20px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked+.toggle-slider {
            background-color: #0078ff;
        }

        input:checked+.toggle-slider:before {
            transform: translateX(20px);
        }

        .divider {
            flex: 0 0 auto;
            height: 1px;
            background-color: #eee;
            margin: 8px 0;
        }

        #collapsibleContent {
            flex: 1 1 auto;
            overflow-y: auto;
            max-height: none;
            /* 覆盖之前的限制 */
            padding-right: 5px;
            transition: max-height 0.3s ease, opacity 0.3s ease;
            max-height: 800px;
            opacity: 1;
        }

        /* 新增折叠样式 */
        #collapsibleContent.collapsed {
            max-height: 0;
            opacity: 0;
            overflow: hidden;
            padding-right: 0;
        }

        /* 滚动条美化继续保留 */
        #collapsibleContent::-webkit-scrollbar {
            width: 6px;
        }

        #collapsibleContent::-webkit-scrollbar-track {
            background: transparent;
        }

        #collapsibleContent::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 3px;
        }

        .collapsible-content {
            transition: all 0.3s ease;
            overflow-y: auto;
            max-height: 600px;
            /* 控制最大高度 */
            scrollbar-width: thin;
            scrollbar-color: #ccc rgba(0, 0, 0, 0.1);
        }

        /* Webkit 滚动条样式（Chrome/Safari） */
        .collapsible-content::-webkit-scrollbar {
            width: 6px;
        }

        .collapsible-content::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.05);
            border-radius: 10px;
        }

        .collapsible-content::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 10px;
        }

        .collapsible-content::-webkit-scrollbar-thumb:hover {
            background: #999;
        }

        #pointCount,
        #totalLength {
            margin: 8px 0;
            font-weight: 500;
            color: #333;
            text-align: center;
            border: 1px dashed #cccccc;
            border-radius: 6px;
            padding: 6px;
            background-color: rgba(255, 255, 255, 0.5);
        }

        #pointCountValue,
        #lengthValue {
            color: #FF6F61;
            font-weight: bold;
            font-size: 15px;
        }

        .pin-icon {
            margin-right: 6px;
            font-size: 16px;
            vertical-align: middle;
        }

        .controls p {
            margin: 8px 0;
            line-height: 1.4;
            font-size: 14px;
            color: #555;
        }

        .style-row {
            display: flex;
            gap: 10px;
            align-items: center;
            margin: 15px 0;
        }

        .color-module,
        .linestyle-module {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 5px;
            min-width: 0;
            /* 新增：防止 flex 子元素被挤压 */
        }

        .color-module {
            padding-left: 30px;
        }

        .color-module strong,
        .linestyle-module strong {
            font-size: 13px;
            font-weight: 500;
            color: #555;
        }

        .custom-color-picker {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 5px 0;
        }

        #colorPreview {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 2px solid #fff;
            box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
            background-color: #FF6F61;
            cursor: pointer;
        }

        #colorCode {
            min-width: 60px;
            display: inline-block;
            font-size: 11px;
            color: #555;
        }

        .linestyle-picker {
            display: flex;
            gap: 15px;
            margin: 8px 0;
            align-items: center;
            white-space: nowrap;
            /* 新增：禁止文字换行 */
            width: 100%;
            /* 新增：让容器占满宽度 */
        }

        .radio-input {
            display: none;
        }

        .radio-label {
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            font-size: 13px;
            color: #555;
            transition: all 0.2s;
        }

        .radio-circle {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            border: 2px solid #ddd;
            position: relative;
            transition: all 0.2s;
        }

        .radio-input:checked+.radio-label .radio-circle {
            border-color: #0078ff;
            background-color: #0078ff;
        }

        .radio-input:checked+.radio-label .radio-circle::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: white;
        }

        .radio-label:hover .radio-circle {
            border-color: #0078ff;
        }

        .slider-group {
            margin: 20px 0;
            font-size: 13px;
            color: #444;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .slider-group label {
            flex: 0 0 auto;
            font-weight: 500;
            min-width: 60px;
        }

        .slider-group input[type="range"] {
            flex: 1 1 auto;
            width: auto;
        }

        .slider-group .slider-value {
            flex: 0 0 30px;
            text-align: center;
            font-weight: 500;
            color: #0078ff;
        }

        .slider-group.disabled {
            opacity: 0.5;
            pointer-events: none;
        }

        .btn-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 30px;
        }

        .btn-row.inline-btn-group {
            width: 100%;
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        /* 新增行内按钮组样式 */
        .inline-btn-group {
            display: flex;
            gap: 8px;
            /* 按钮之间的间距 */
            width: 100%;
        }

        .inline-btn-group button {
            flex: 1;
            /* 三个按钮平分宽度 */
            padding: 8px 0;
            /* 保持垂直内边距，水平内边距按需调整 */
        }

        .full-width-btn {
            flex: 1;
            min-width: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        button {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            color: white;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 13px;
        }

        button:hover {
            opacity: 0.9;
            transform: translateY(-1px);
        }

        button:disabled {
            background: #ccc !important;
            cursor: not-allowed;
            transform: none !important;
            opacity: 1 !important;
        }

        #startBtn {
            background: #0078ff;
        }

        #undoLastPointBtn {
            background: #6c757d;
        }

        #redrawBtn {
            background: #ff9500;
        }

        #saveBtn {
            background: #00c853;
        }

        #loadGeoJsonBtn {
            background: #9c27b0;
        }

        #clearAllBtn {
            background: #ff3b30;
        }

        .popup-content {
            padding: 12px;
            width: 240px;
            font-size: 14px;
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.95);
        }

        .popup-content input {
            width: 100%;
            padding: 6px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            margin: 4px 0 8px;
        }

        .popup-content h4 {
            margin: 0 0 8px 0;
            color: #333;
        }

        .popup-field-label {
            font-size: 13px;
            color: #666;
            margin-bottom: 2px;
            display: block;
        }

        .popup-btn-group {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        .save-btn {
            flex: 1;
            background: #0078ff;
        }

        .delete-btn {
            flex: 1;
            background: #ff3b30;
        }

        .mapboxgl-ctrl-bottom-right {
            display: none !important;
        }

        .map-marker {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            border: 2px solid white;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
            cursor: move;
            transition: transform 0.2s;
            pointer-events: auto;
            z-index: 1001;
        }

        .map-marker:hover {
            transform: scale(1.3);
        }

        .route-name-input {
            margin: 1px 0 15px 0;
        }

        .route-name-input label {
            display: block;
            font-size: 13px;
            color: #555;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .route-name-input input {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 13px;
            box-sizing: border-box;
        }