* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f7;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    padding: 30px 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 48px;
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-weight: 600;
    letter-spacing: -1px;
}

header p {
    font-size: 0.95em;
    color: #6b7280;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* 控制面板 */
.control-panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 340px;
    flex-shrink: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.section {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 16px;
}

.section:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.section.collapsed .section-content {
    display: none;
}

.section-title {
    color: #1a1a1a;
    margin-bottom: 14px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.section-title:hover {
    background: #f9fafb;
}

.toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s;
    display: inline-block;
    width: 15px;
}

.section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-section {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 15px;
}

.export-section .control-row {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.control-group {
    margin-bottom: 10px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-weight: 500;
    font-size: 13px;
}

/* 紧凑的控制行 */
.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    font-size: 13px;
    color: #374151;
}

.control-label {
    font-size: 13px;
    color: #374151;
    min-width: 70px;
    flex: 0 0 auto;
    font-weight: 500;
}

.value-display {
    min-width: 28px;
    text-align: center;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}

.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 14px 0;
}

.control-group input[type="text"],
.control-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
}

.select-sm {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
}

.select-sm:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
}

.control-group input[type="color"],
.control-row input[type="color"] {
    width: 42px;
    height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
    transition: border-color 0.2s;
}

.control-group input[type="color"]:hover,
.control-row input[type="color"]:hover {
    border-color: #9ca3af;
}

.control-group input[type="range"] {
    width: calc(100% - 50px);
    margin-right: 10px;
}

.range-sm {
    flex: 1;
    height: 5px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
}

.range-sm::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #1a1a1a;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.range-sm::-webkit-slider-thumb:hover {
    background: #2a2a2a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.range-sm::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #1a1a1a;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.range-sm::-moz-range-thumb:hover {
    background: #2a2a2a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group input[type="checkbox"],
.control-row input[type="checkbox"] {
    margin-right: 7px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1a1a1a;
}

.emoji-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.emoji-group input {
    flex: 1;
}

.emoji-group + button {
    margin-top: 10px;
}

/* 按钮样式 */
.upload-btn {
    display: block;
    cursor: pointer;
    width: 100%;
}

.upload-btn input[type="file"] {
    display: none;
}

.upload-btn span {
    display: block;
    padding: 11px 18px;
    background: linear-gradient(to bottom, #ffffff, #fafafa);
    color: #1a1a1a;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.upload-btn:hover span {
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-color: #9ca3af;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.upload-btn:active span {
    background: #f0f0f0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

button {
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

button:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    color: white;
    border-color: #1a1a1a;
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: linear-gradient(to bottom, #ffffff, #fafafa);
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-color: #9ca3af;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-group button {
    flex: 1;
}

.btn-export {
    flex: 1;
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    color: white;
    padding: 11px 18px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #1a1a1a;
    letter-spacing: 0.3px;
}

.btn-export:hover {
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* 画布区域 */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-wrapper {
    background: white;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: inline-block;
}

#mainCanvas {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

.tips {
    margin-top: 24px;
    background: white;
    padding: 18px 24px;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tips p {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.tips ul {
    list-style: none;
    padding: 0;
}

.tips ul li {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 8px;
    padding-left: 18px;
    position: relative;
    line-height: 1.5;
}

.tips ul li:before {
    content: "·";
    position: absolute;
    left: 4px;
    color: #6b7280;
    font-size: 16px;
}

/* 头像列表样式 */
.avatar-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    background: #fafafa;
}

.avatar-list::-webkit-scrollbar {
    width: 5px;
}

.avatar-list::-webkit-scrollbar-track {
    background: transparent;
}

.avatar-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.avatar-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.empty-tip {
    color: #9ca3af;
    text-align: center;
    font-size: 13px;
    margin: 12px 0;
}

.avatar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.avatar-item:last-child {
    margin-bottom: 0;
}

.avatar-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.avatar-item.selected {
    background: #f9fafb;
    border: 2px solid #1a1a1a;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.avatar-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0; /* 允许flex子元素正确收缩 */
    overflow: hidden; /* 防止内容溢出 */
}

.avatar-item-preview {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-item-text {
    flex: 1;
    min-width: 0; /* 允许文字正确收缩和省略 */
    overflow: hidden; /* 防止文字溢出 */
    max-width: 140px; /* 限制最大宽度，确保按钮可见 */
}

.avatar-item-name {
    font-size: 13px;
    color: #1a1a1a;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    max-width: 100%; /* 确保省略号生效 */
}

.avatar-item-size {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap; /* 防止尺寸信息换行 */
}

.avatar-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0; /* 防止按钮被挤压 */
}

.avatar-item-btn {
    padding: 5px 10px;
    font-size: 11px;
    background: linear-gradient(to bottom, #ffffff, #fafafa);
    border: 1px solid #d1d5db;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.avatar-item-btn:hover {
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    color: white;
    border-color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-item-btn:active {
    transform: scale(0.95);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
    }

    .canvas-wrapper {
        width: 100%;
        padding: 20px;
    }

    #mainCanvas {
        width: 100%;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .control-panel {
        padding: 20px;
    }

    .section h3 {
        font-size: 1em;
    }
}

/* 自定义提示弹窗（长条椭圆形 - 超强高斯模糊毛玻璃效果） */
.custom-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -20px);
    /* 更浅的半透明背景 + 多层模糊 */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.2);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.2);
    /* 深色文字更清晰 */
    color: #1a1a1a;
    padding: 18px 52px;
    border-radius: 50px;
    /* 更明显的亮色边框 */
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    font-size: 16px;
    font-weight: 600;
    /* 更强的阴影和内阴影 */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 0.5px;
    /* 添加内部光晕效果 */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.custom-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 成功提示样式（绿色调） */
.custom-toast.success {
    background: rgba(16, 185, 129, 0.15);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 
        0 8px 32px rgba(16, 185, 129, 0.2),
        0 2px 8px rgba(16, 185, 129, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 错误提示样式（红色调） */
.custom-toast.error {
    background: rgba(239, 68, 68, 0.15);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 
        0 8px 32px rgba(239, 68, 68, 0.2),
        0 2px 8px rgba(239, 68, 68, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 警告提示样式（橙色调） */
.custom-toast.warning {
    background: rgba(245, 158, 11, 0.15);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 
        0 8px 32px rgba(245, 158, 11, 0.2),
        0 2px 8px rgba(245, 158, 11, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 信息提示样式（蓝色调） */
.custom-toast.info {
    background: rgba(59, 130, 246, 0.15);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 
        0 8px 32px rgba(59, 130, 246, 0.2),
        0 2px 8px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 自定义确认对话框 */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 更浅的遮罩 + 超强模糊 */
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.custom-confirm-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.custom-confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-confirm-overlay.show .custom-confirm-dialog {
    transform: scale(1) translateY(0);
}

.custom-confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
}

.custom-confirm-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.custom-confirm-message {
    font-size: 15px;
    color: #6b7280;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 28px;
}

.custom-confirm-buttons {
    display: flex;
    gap: 12px;
}

.custom-confirm-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.custom-confirm-btn-cancel {
    background: #f3f4f6;
    color: #6b7280;
}

.custom-confirm-btn-cancel:hover {
    background: #e5e7eb;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-confirm-btn-confirm {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.custom-confirm-btn-confirm:hover {
    background: linear-gradient(135deg, #ff5252, #ff4444);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.custom-confirm-btn:active {
    transform: translateY(0) scale(0.98);
}

