        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        :root {
            --main-color: #8080FF;
            --reverse-color: #FF8A65;
            --bg-background: #242428;
            --btcolor: linear-gradient(to left, #6450ff, #8f56fa);
            --text1: #fff;
            --text2: #c7d1e2;
            --text3: #969dbb;
            --line: #7878784d;
            --mainbg: #2e2e33d9;
            --shadow: #8080ff99;
            --btbg: #babac5;
            --lightbg: #36363b;
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #1a1b1c;
            min-height: 100vh;
            overflow: hidden;
            color: var(--text2);
        }
        .icon {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    fill: currentColor;
}
.control-label {
        color: var(--text2);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    justify-content: flex-start;
}
.controls2 {
            display: flex;
    gap: 25px;
    padding: 10px 16px 20px;
    justify-content: space-between;
}
/* 【新增代码】放到 <style> 标签内任意位置 */
#downloadGrayBtn {
    background: var(--btbg);
    color: #000;
    margin: auto;
    transition: all 0.3s ease;
}

#downloadGrayBtn:hover {
    background: #fff;
    box-shadow: 0 5px 15px rgba(186, 186, 197, 0.4);
    transform: translateY(-2px);
}
/* 【新增代码】放到 <style> 标签内任意位置 */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}
	.under {
		display: grid; 
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;          /* 新增列间距 */
    font-size: 0.9rem;
    list-style-position: inside; /* 保证圆点不跑出列外 */
	}
        .topgroup {
            gap: 10px;
            display: flex;
            position: fixed;
            margin-top: 20px;
            left: 20px;
            background: #2b2b2f;
            border-radius: 30px;
            padding: 4px;
            z-index: 999;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
        }
        .home-icon {
            font-size: 40px;
            cursor: pointer;
            transition: all 0.3s;
            padding: 8px; 
            border-radius: 50%;
            width: 1em; 
            height: 1em;
            vertical-align: -0.15em;
            overflow: hidden;
        }
        .topgroup:hover {
            background:#36363b;
        }
        .kuang {
            background: var(--lightbg);
            border-radius: 8px;
            border: 1px solid var(--line);
        }
        .scrib{
            color: var(--text3); 
            font-size: 0.9rem;
            font-weight: 400;
        }
        .canshu {
            background: #2b2b2f;
            padding: 0 6px;
            border-radius: 4px;
        }
        .line {
            width: 100%;
            height: 1px;
            background: var(--line);
        }
        .line2 {
            width: 100%;
            height: 1px;
            background: #0a0a14b3;
        }
        .container {
            max-width: 100%; /* 取消1200px宽度限制，改为全屏 */
            margin: 0 auto;
            padding: 20px 30px 20px 90px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            height: 100vh;          /* 新增：全屏高度 */
            overflow: hidden; 
        }
        
        header {
            position: relative;
	    margin-bottom: 10px;
        }
        
        h1 {
            font-size: 1.5rem;
            margin-bottom: 10px;
            color: var(--main-color);
            letter-spacing: 1px;
            position: relative;
	    display: flex;
    flex-wrap: wrap;
    align-items: center;
        }
        
        .header-subtitle {
            color: var(--text3);
            font-size: 0.9rem;
            max-width: 800px;
            margin: 0 auto
        }
        
        .content-n {
            display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: stretch;
    flex: 1;                /* 新增：占据除header外的所有高度 */
    overflow: hidden;       /* 新增：防止网格本身溢出 */
    min-height: 0;  
        }

        
        .panel {
            background: var(--mainbg);
            border-radius: 10px;
            padding: 20px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            display: flex;
            flex-direction: column;
            height: 100%;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            overflow-y: auto;       /* 新增：内容超出时面板内出现滚动条 */
    min-height: 0;
        }
        .panel::-webkit-scrollbar {
    width: 6px;
}
.panel::-webkit-scrollbar-track {
    background: #1e1e22;              /* 与最深背景接近 */
    border-radius: 3px;
}
.panel::-webkit-scrollbar-thumb {
    background: #4a4a55;              /* 半亮色滑块 */
    border-radius: 3px;
    transition: background 0.2s;
}
.panel::-webkit-scrollbar-thumb:hover {
    background: #6a6a7a;              /* 悬停变亮 */
}
/* Firefox 滚动条 */
.panel {
    scrollbar-width: thin;
    scrollbar-color: #4a4a55 #1e1e22;
}
        .panel h2 {
            font-size: 1rem;
            margin: 0 0 15px;
            color: var(--text1);
            display: flex;
            align-items: center;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--line);
        }

         .controls {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap:  14px 25px;
            padding: 10px 16px 20px;
            justify-content: space-between;
        }
        .under-text {
            margin-top: 15px;
            display: flex;
            flex-direction: column;
        }
        /* 新增：专门给 3D 材质物理属性设置的单行排列样式 */
        .controls-inline {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px 15px;
            flex-wrap: wrap;
        }
        .controls-inline .control-group {
            flex-direction: row; /* 让滑块和文字在一行 */
            align-items: center;
            gap: 8px;
            margin: 0;
        }
        .control-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        label {
            color: var(--text2);
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
	justify-content: space-between;
    border-radius: 30px;
        }
.controlbar-container {
    position:absolute; 
    padding: 10px;
    z-index:10; 
    display:flex; 
    align-items:center; 
    gap:8px;
    width: -webkit-fill-available;
    justify-content: space-between;
}
.controlbar {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.controlbar-range {
    width: 80px !important; 
    height: 4px !important; 
    background: rgba(255,255,255,0.2) !important; 
}
.controlbar-value {
    color: var(--text1);
    font-size: 12px;
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}  
        input[type="range"] {
            width: 100%;
            height: 6px;
            background: var(--main-color);
            border-radius: 5px;
            outline: none;
            -webkit-appearance: none;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 20px;
            height: 20px;
            background: #fff;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid var(--main-color);
            transition: all 0.2s ease;
            box-shadow: 0 0 8px rgba(128, 128, 255, 0.6);
        }
        
        input[type="range"]::-webkit-slider-thumb:hover {
            transform: scale(1.1);
        }
        
        input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: var(--main-color);
            cursor: pointer;
        }
        
        .btn-group {
            display: flex;
            gap: 15px;
            grid-column: 1 / -1;
            margin: 16px 0 20px 0;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        button {
            background: none;
            color: #fff;
            border: none;
            padding: 8px 25px;
            border-radius: 30px;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            position: relative;
            overflow: hidden;
        }

        button:active {
            transform: translateY(1px);
        }
        
        #downloadMapBtn {
            background: var(--btcolor);
            color: #fff;
        }
        
        #downloadMapBtn:hover {
            box-shadow: 0 10px 16px -6px var(--shadow);
        }
        
        .canvas-container {
            position: relative;
            background: rgba(10, 10, 20, 0.7);
            border-radius: 8px;
            overflow: hidden;
            min-height: 270px;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 1px solid rgba(128, 128, 255, 0.1);
            width: 100%;
        }
        
        .canvas-container:hover {
            border-color: var(--main-color);
        }
        
        canvas {
            max-width: 100%;
            background: #111;
            border-radius: 8px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
            image-rendering: -moz-crisp-edges;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
            -ms-interpolation-mode: nearest-neighbor;
            transition: transform 0.3s ease;
        }
        
        canvas:hover {
            transform: scale(1.015);
        }
        
        .placeholder {
            color: var(--text2);
            text-align: center;
            padding: 40px;
            font-size: 1rem;
            line-height: 1.7;
        }
        
        .placeholder svg {
            font-size: 3.5rem;
            display: block;
            margin-bottom: 25px;
            color: var(--text2);
            text-shadow: 0 0 15px rgba(128, 128, 255, 0.4);
        }
        
        .value-display {
            display: flex;
            justify-content: space-between;
            font-size: 1rem;
            color: #90caf9;
            background: rgba(0, 0, 40, 0.5);
            padding: 10px;
            border-radius: 6px;
            margin: 10px 0;
        }
        
        footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid var(--line);
            color: var(--text3);
            font-size: 1rem;
        }
        
        .example-images {
            display: flex;
            gap: 10px;
            flex-direction: column;
        }
        
        .example-image {
            width: 70px;
            height: 70px;
            border-radius: 10px;
            overflow: hidden;
            cursor: pointer;
            opacity: 0.9;
            transition: all 0.3s ease;
            border: 2px solid var(--line);
            position: relative;
        }
        
        .example-image:hover {
            opacity: 1;
            transform: translateY(-7px);
            border-color: #8080FF;
            box-shadow: 0 8px 20px rgba(128, 128, 255, 0.6);
        }
        
        .example-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .example-image .label {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(0deg, #242424, transparent);
            color: white;
            text-align: center;
            font-size: 0.8rem;
        }
        
        .progress-container {
            display: none;
            z-index: 999;
            position: fixed;
            padding: 10px 20px;
            margin: 0 auto;
            width: 30%;
            background: var(--line);
            border-radius: 10px;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            left: 0;
            right: 0;
            top: 50px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
        }
        
        .progress-bar {
            height: 12px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            overflow: hidden;
        }
        
        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #00c853, #76ff03);
            width: 0%;
            transition: width 0.4s ease;
            border-radius: 6px;
        }
        
        .quality-indicator {
            display: flex;
            justify-content: space-between;
            font-size: 0.95rem;
            color: var(--text2);
            margin-bottom: 10px;
        }
        
        .param-info {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            color: var(--text3);
        }
        
        .section-title {
            text-align: center;
            margin: 20px 0 15px;
            color: #bbdefb;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }
        
        .file-upload-area {
            background: var(--bg-background);
            border-radius: 10px;
            padding: 20px;
            border: 2px dashed var(--line);
            text-align: center;
            transition: all 0.3s ease;
            margin: 10px 40px 20px;
        }
        
        .file-upload-area:hover {
            border-color: var(--main-color);
            background: rgba(0, 0, 30, 0.4);
        }
        
        .file-upload-area label {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 5px;
            cursor: pointer;
            font-size: 1rem;
	justify-content: center;
        }
        
        .file-upload-area svg {
            font-size: 2.5rem;
            color: var(--main-color);
            transition: all 0.3s ease;
	    margin-right: 10px;
        opacity: 0.7;
        }
        
        .file-upload-area:hover svg {
            color: var(--main-color);
        }
        
        .info-text {
            background: rgba(10, 10, 20, 0.6);
            padding: 15px;
            border-radius: 10px;
            margin-top: 20px;
            font-size: 0.95rem;
            color: var(--text3);
            line-height: 1.7;
        }
        
        .info-text svg {
            color: var(--main-color);
            margin-right: 8px;
        }
        
        .panel-title {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            justify-content: space-between;
            margin-top: 16px;
        }
        
        .panel-title h2 {
            margin: 0;
            padding-bottom: 0;
            border: none;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.9);
            justify-content: center;
            align-items: center;
        }
        
        .modal-content {
            max-width: 90%;
            max-height: 90%;
            border-radius: 10px;
        }
        
        .close {
            position: absolute;
            top: 20px;
            right: 35px;
            color: #f1f1f1;
            font-size: 40px;
            font-weight: bold;
            transition: 0.3s;
            cursor: pointer;
        }
        
        .close:hover,
        .close:focus {
            color: #8080FF;
            text-decoration: none;
        }
        
        .drag-over {
            border-color: var(--main-color) !important;
            background: rgba(128, 128, 255, 0.1) !important;
        }
        
        .reverse-info {
            background: rgba(255, 138, 101, 0.1);
            border-left: 4px solid var(--reverse-color);
            padding: 15px;
            border-radius: 0 8px 8px 0;
            margin-top: 15px;
            font-size: 0.9rem;
        }
        
        .algorithm-info {
            display: flex;
            flex-direction: row;
            gap: 10px;
            margin-top: 15px;
            align-items: center;
        }
        
        .algorithm-option {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 20px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .algorithm-option input[type="radio"] {
            accent-color:var(--main-color);
        }
        
        .algorithm-option label {
            cursor: pointer;
            font-size: 0.9rem;
        }
        .algorithm-option label:hover {
            color: var(--main-color);
        }
        .algorithm-description {
            font-size: 0.8rem;
            color: var(--text3);
            padding-left: 28px;
            margin-top: 4px;
        }
        
        .format-badge {
            background: rgba(128, 128, 255, 0.2);
            border-radius: 4px;
            padding: 2px 6px;
            font-size: 0.8rem;
            margin-left: 8px;
        }
        
        .drag-hint {
            position: absolute;
            bottom: 15px;
            left: 0;
            right: 0;
            text-align: center;
            color: var(--text3);
            font-size: 0.9rem;
            opacity: 0.8;
        }
        
        .mode-toggle {
            display: flex;
            justify-content: center;
        }
        
        .toggle-btn {
            border: 1px solid var(--btbg);
            color: var(--btbg);
            padding: 8px 25px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            width: max-content;
        }
        
        .toggle-btn.active {
            background: var(--btbg);
            color: #000;
        }
        
        .toggle-btn:hover {
            background: var(--btbg);
            color: #000;
        }
        
        .perf-info {
            background: #00ff0021;
            padding: 10px;
            border-radius: 28px;
            margin-top: 16px;
            text-align: center;
            font-size: 0.9rem;
            display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    color: #00ff00;
        }
        
        .value-input {
            background: var(--bg-background);
            border: 1px solid #454559;
            color: var(--text1);
            border-radius: 4px;
            padding: 6px 8px;
            width: 70px;
            text-align: center;
            font-size: 0.95rem;
            outline: none;
        }
        
        .value-input:focus {
            border-color: var(--main-color);
            box-shadow: 0 0 5px rgba(128, 128, 255, 0.5);
        }
        
        .size-toggle {
            display: flex;
        }
        
        .size-toggle .toggle-btn {
            padding: 4px 12px;
            font-size: 0.8rem;
        }
        
#preview3dContainer {
    height: 380px;         /* 适当高度 */
    min-height: 300px;     /* 保底高度 */
    flex-shrink: 0;        /* ▼ 核心：绝对禁止被参数面板挤压变形 ▼ */
    width: 100%;
    background: #111;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
}
        
        #preview3dContainer canvas {
            width: 100%;
            height: 100%;
            display: block;
            border-radius: 8px;
        }
        .text-btn {
    background: transparent;
    border: none;
    color: var(--text3);
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    padding: 6px 12px;
}
.text-btn:hover {
    color: var(--main-color);
}
        .preview-controls {
            position: absolute;
            bottom: 10px;
            left: 10px;
            z-index: 10;
            display: flex;
        }
        
        .preview-controls .toggle-btn {
            padding: 4px 10px;
            font-size: 0.75rem;
            margin-right: -1px;
        }
        
        .preview-hint {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: var(--text3);
            font-size: 0.9rem;
            text-align: center;
            max-width: 80%;
        }

        .preview-ready {
            display: block !important;
        }
        
        .progress-fill {
            transition: width 0.3s ease-out;
        }

        /* 新增样式 for tabs */
        .map-type-tabs {
            display: flex;
            gap: 5px;
            margin-bottom: 16px;
            background-color: var(--bg-background);
            padding: 5px;
            border-radius: 8px;
        }
        .tab-btn {
            flex-grow: 1;
            padding: 8px 5px;
            cursor: pointer;
            border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--text2);
            font-size: 0.9rem;
            transition: background-color 0.3s, color 0.3s;
            text-align: center;
	height: auto;
        }
        .tab-btn:hover {
            background-color: var(--lightbg);
        }
        .tab-btn.active {
                background-color: var(--btbg);
    		color: var(--lightbg);
            font-weight: bold;
        }
        .param-panel {
            display: none; /* Hide all panels by default */
        }
        .param-panel.active {
            display: block; /* Show active panel */
        }
        /* End of new styles */
/* ================= 强行解除法线图大图限制 ================= */
#outputCanvasContainer {
    height: 320px; /* 初始默认 */
    min-height: 320px;
    flex: none !important; /* 防止被 flex 布局强行压扁挤窄 */
}

/* 确保右侧这一栏面板允许自由向下延展高度 */
.content-n > .panel:nth-child(3) {
    height: auto !important;
    max-height: none !important;
}

/* 确保容器在变大时，内部的 canvas 画布能够填满，并且不会因为 flex 压缩变形 */
#outputCanvasContainer canvas, 
#outputCanvas {
    width: 100% !important;
    object-fit: contain;
}

/* 确保右侧整个生成结果面板允许纵向内容撑开，不锁死高度 */
.content-n .panel {
    height: auto !important;
    max-height: none !important;
}
.mobile-tabs {
    display: none; 
}

        @media (max-width: 768px) {
            body { overflow: auto;           /* 允许页面滚动 */
    }
    .mobile-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 5px;
        background: var(--bg-background);
        padding: 5px;
        border-radius: 8px;
        margin: 0 15px 5px 15px; /* 两侧留点边距 */
    }
    .controls2 {
        display: grid;
        padding: 15px;
        gap: 8px;
        grid-template-columns: 1fr 1fr;
    }
    .mobile-tab {
        background: transparent;
        border: none;
        color: var(--text2);
        padding: 8px 0;
        font-size: 0.9rem;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .mobile-tab.active {
        background: var(--btbg);
        color: var(--lightbg);
        font-weight: bold;
    }

    /* 2. 默认隐藏所有面板 */
    .content-n .panel {
        display: none !important; 
    }
    
    /* 3. 仅显示带有 active-mobile 类的面板 */
    .content-n .panel.active-mobile {
        display: flex !important;
        margin: 0; 
    }
    .file-upload-area {
        margin: 0 0 20px;
    }
    h1 {
        justify-content: center;
    }
    .header-subtitle {
        text-align: center;
    }
	.progress-container {
		width: 80%;}
	.panel-title {
	    flex-wrap: wrap;
    	gap: 8px;}
	.example-image {    
	    width: 60px;
    	height: 60px;}
            .content-n {
		    display: flex;
	    	flex-direction: column;
		    padding: 0;
            flex: none;               /* 取消 flex 拉伸，回到正常文档流 */
        overflow: visible;        /* 允许子元素溢出 */
        min-height: auto; 
        }
	.under {
		grid-template-columns: 1fr;
	}
	.container {
		    padding: 20px 0;
            height: auto;             /* 取消固定高度 */
        overflow: visible;  
		}
            .panel {
                padding: 20px 15px;
                min-width: auto;
                overflow-y: auto;
        min-height: 0; 
        overflow-y: visible;      /* 面板不出现内部滚动条 */
        min-height: auto;   
            }

            .scrib {
		}
            .controls {
                padding: 15px;
                gap: 8px;
	grid-template-columns: 1fr;
            }
            .example-images {
		gap: 10px;
    		margin-right: 10px;
		}
            button {
                padding: 10px 20px;
                font-size: 0.88rem;
                min-width: auto;
            }
        .toggle-btn{
            font-size: 0.88rem;
            padding: 8px 14px;
        }
	.algorithm-option {
	    padding: 8px 14px;}
        .map-type-tabs {
        }
        .tab-btn {
            font-size: 0.8rem;
	padding: 4px 5px;
        }
        }
