/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background: #000;
    color: white;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* 防止缩放 */
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* 防止双击选中 */
    -webkit-tap-highlight-color: transparent;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

#container {
    position: relative;
    width: var(--vw, 100vw); /* 使用CSS自定义属性，fallback到100vw */
    height: var(--vh, 100vh); /* 使用CSS自定义属性，fallback到100vh */
    background: #000;
    /* 防止缩放和选中 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    /* 防止缩放 */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 多层canvas样式 */
.canvas-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    /* transform将由JavaScript动态设置 */
    border: 2px solid rgba(255, 255, 255, 0.3);
    /* 防止缩放和选中 */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.canvas-layer {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    transition: opacity 0.2s ease;
    z-index: 2;
    /* 防止缩放和选中 */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* 近邻插值模式，保持像素锐利 */
    /* image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast; */
}

/* 背景叠加层样式 */
.canvas-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

/* 当前活跃的绘画层级 */
.canvas-wrapper.active-layer {
    border: 3px solid rgba(0, 245, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.5);
}

/* Canvas层级样式现在通过JavaScript动态设置 */

/* 顶部工具栏 */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    z-index: 1000;
    padding: 16px 24px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.toolbar.show {
    transform: translateY(0);
}

.toolbar-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

/* ====== 画笔工具组 ====== */
.brush-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

/* 画笔按钮组 */
.brush-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* ====== 颜色控制组 ====== */
.color-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* 滑块控件 */
.size-control-horizontal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 6px 16px;
}

.size-control-horizontal:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ====== 功能按钮组 ====== */
.function-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* ====== 按钮统一样式 ====== */
.brush-btn {
    width: 40px !important;
    height: 40px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    border-radius: 10px !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    font-size: 18px !important;
    cursor: pointer;
}

.brush-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.brush-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9)) !important;
    border-color: rgba(59, 130, 246, 1) !important;
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
    color: white !important;
}

.brush-btn.active::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(147, 51, 234, 0.4));
    z-index: -1;
    filter: blur(6px);
}

/* ====== 颜色选择器样式 ====== */
#brush-color, #bg-color {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: none;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#brush-color:hover, #bg-color:hover {
    border-color: rgba(148, 163, 184, 0.7);
    transform: scale(1.15);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#brush-color::-webkit-color-swatch-wrapper, #bg-color::-webkit-color-swatch-wrapper {
    border: none;
    border-radius: 50%;
    padding: 0;
}

#brush-color::-webkit-color-swatch, #bg-color::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* 移除旧的分隔线样式 */
.toolbar-divider {
    display: none;
}

/* ====== 陀螺仪按钮特殊状态 ====== */
.brush-btn.gyro-btn {
    position: relative;
}

.brush-btn.gyro-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* 陀螺仪模式 - 绿色 */
.brush-btn.gyro-btn.gyro {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(34, 197, 94, 0.9)) !important;
    border-color: rgba(16, 185, 129, 1) !important;
    box-shadow: 
        0 0 24px rgba(16, 185, 129, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
    color: white !important;
}

.brush-btn.gyro-btn.gyro::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #10f981;
    border-radius: 50%;
    box-shadow: 
        0 0 8px #10f981,
        0 0 16px rgba(16, 249, 129, 0.6);
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

/* 自动转动模式 - 蓝色 */
.brush-btn.gyro-btn.auto {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9)) !important;
    border-color: rgba(59, 130, 246, 1) !important;
    box-shadow:
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
    color: white !important;
}

.brush-btn.gyro-btn.auto::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    box-shadow:
        0 0 8px #3b82f6,
        0 0 16px rgba(59, 130, 246, 0.6);
    animation: spin-glow 1.5s linear infinite;
}

/* 眼睛追踪模式 - 橙色 */
.brush-btn.gyro-btn.eye {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(251, 146, 60, 0.9)) !important;
    border-color: rgba(249, 115, 22, 1) !important;
    box-shadow:
        0 0 24px rgba(249, 115, 22, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
    color: white !important;
}

.brush-btn.gyro-btn.eye::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #f97316;
    border-radius: 50%;
    box-shadow:
        0 0 8px #f97316,
        0 0 16px rgba(249, 115, 22, 0.6);
    animation: pulse-glow 2s ease-in-out infinite alternate;
}


/* 脉冲动画 */
@keyframes pulse-glow {
    from {
        opacity: 0.8;
        transform: scale(1);
    }
    to {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 旋转动画 */
@keyframes spin-glow {
    from {
        transform: rotate(0deg) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: rotate(180deg) scale(1.2);
        opacity: 1;
    }
    to {
        transform: rotate(360deg) scale(1);
        opacity: 0.8;
    }
}

/* 响应式陀螺仪指示器 */
@media (max-width: 768px) {
    .brush-btn.gyro-btn.gyro::after,
    .brush-btn.gyro-btn.auto::after {
        width: 7px;
        height: 7px;
    }
}

@media (max-width: 480px) {
    .brush-btn.gyro-btn.gyro::after,
    .brush-btn.gyro-btn.auto::after {
        width: 6px;
        height: 6px;
    }
}

/* 底部层级面板样式 */
.layer-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    z-index: 1000;
    padding: 20px 24px;
    box-shadow: 
        0 -10px 40px rgba(0, 0, 0, 0.3),
        0 -4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 16px;
}

.layer-panel.show {
    transform: translateY(0);
}

/* 左侧层级操作区域 */
.layer-operations {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* 右侧图片导入区域 */
.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.import-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.import-image-btn-main {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border-color: rgba(59, 130, 246, 1);
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.import-image-btn-main:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    border-color: rgba(59, 130, 246, 1);
    box-shadow: 
        0 0 32px rgba(59, 130, 246, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 层级控制按钮样式 */
.layer-control-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.layer-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.layer-control-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.layer-control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.layer-control-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
    transform: none;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* 层级控制按钮分隔线 */
.layer-divider {
    width: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.4), transparent);
    margin: 4px 0;
    flex-shrink: 0;
}

.layer-list {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    flex: 1;
    /* 确保水平滚动可以正常工作 */
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}

/* 自定义滚动条样式 */
.layer-list::-webkit-scrollbar {
    height: 6px;
}

.layer-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.layer-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.layer-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.layer-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 14px 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 90px;
    max-width: 90px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.layer-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(147, 51, 234, 0.2));
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 
        0 0 20px rgba(59, 130, 246, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.layer-item.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    z-index: -1;
    filter: blur(4px);
}

/* Sortable.js 拖拽相关样式 */
.layer-item {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Sortable.js 拖拽状态样式 */
.sortable-chosen {
    opacity: 0.8;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.sortable-drag {
    opacity: 0.6;
    transform: rotate(5deg) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.sortable-ghost {
    opacity: 0.3;
    background: rgba(59, 130, 246, 0.2);
    border: 2px dashed rgba(59, 130, 246, 0.5);
    transform: scale(0.95);
}

.sortable-fallback {
    opacity: 0.7;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid rgba(59, 130, 246, 0.7);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transform: rotate(5deg) scale(1.05);
    z-index: 1001;
}

/* 确保子元素不会阻止交互 */
.layer-item .layer-preview,
.layer-item .layer-info,
.layer-item .layer-preview-canvas {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.layer-info {
    color: white;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.9;
}

.layer-preview {
    width: 60px;
    height: 75px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(15, 23, 42, 0.3));
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.2),
        0 1px 4px rgba(0, 0, 0, 0.1);
}

.layer-preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    display: block;
    /* 近邻插值模式，保持像素锐利 */
    /* image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast; */
}

/* 面板拉柄样式 */
.panel-handle {
    position: fixed;
    width: 120px; /* 减小宽度以适应左右定位 */
    height: 32px; /* 增加高度，让拉柄更容易抓取 */
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px; /* 相应增加圆角 */
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.panel-handle:hover {
    background: linear-gradient(135deg, rgba(25, 33, 52, 0.98), rgba(40, 51, 69, 0.98));
    border-color: rgba(148, 163, 184, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.panel-handle:active {
    transform: scale(0.98);
}

/* 拉柄抓握纹理 */
.handle-grip {
    width: 50px; /* 增加宽度适应新的handle尺寸 */
    height: 5px; /* 增加高度 */
    background: rgba(148, 163, 184, 0.3);
    border-radius: 2.5px;
    position: relative;
}

.handle-grip::before,
.handle-grip::after {
    content: '';
    position: absolute;
    width: 50px; /* 增加宽度适应新的handle尺寸 */
    height: 2.5px; /* 增加高度 */
    background: rgba(148, 163, 184, 0.2);
    border-radius: 1.25px;
    left: 0;
}

.handle-grip::before {
    top: -5px; /* 调整间距 */
}

.handle-grip::after {
    bottom: -5px; /* 调整间距 */
}

/* 顶部工具栏拉柄位置 - 由JavaScript动态控制 */
.toolbar-handle {
    top: -5px; /* 默认隐藏位置，将由JS覆盖 */
    left: 20px; /* 调整到最左边 */
    transform: none; /* 移除居中的transform */
}

/* 底部层级面板拉柄位置 - 由JavaScript动态控制 */
.layer-handle {
    bottom: -5px; /* 默认隐藏位置，将由JS覆盖 */
    right: 20px; /* 调整到最右边 */
    left: auto; /* 重置left属性 */
    transform: none; /* 移除居中的transform */
}

/* 统一的圆形按钮基础样式 */
button {
    /* 基础样式 */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    
    /* 外观 */
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: white;
    font-size: 18px;
    
    /* 布局 */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 交互 */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 效果 */
    backdrop-filter: blur(15px);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    /* 防止缩放和选中 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
}

/* 确保input元素不受button样式影响 */
input {
    /* 重置button样式的影响，但保留input的基本功能 */
    width: auto;
    height: auto;
    border-radius: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: inherit;
    font-size: inherit;
    display: inline-block;
    align-items: initial;
    justify-content: initial;
    cursor: auto;
    transition: none;
    backdrop-filter: none;
    box-shadow: none;
    /* 确保input元素可以正常交互 */
    touch-action: auto;
    pointer-events: auto;
}

/* 横向滑动条样式 */
#brush-size {
    width: 130px; /* 调整宽度适应新容器 */
    height: 4px; /* 稍微减小高度 */
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    border: none;
    /* 确保slider可以正常触摸滑动 */
    touch-action: pan-x; /* 改为横向滑动 */
    pointer-events: auto;
    position: relative;
    z-index: 10;
    transition: all 0.2s ease;
    /* 移除垂直模式的样式 */
    writing-mode: initial;
    direction: initial;
    /* 移除默认外观以便自定义样式 */
    -webkit-appearance: none;
    appearance: none;
}

#brush-size:hover {
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
}

/* 横向滑动条轨道样式 */
#brush-size::-webkit-slider-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    border: none;
}

#brush-size::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    border: none;
}

/* 横向滑动条thumb样式 */
#brush-size::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 
        0 2px 6px rgba(59, 130, 246, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

#brush-size::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 
        0 3px 8px rgba(59, 130, 246, 0.6),
        inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

#brush-size::-moz-range-thumb {
    width: 24px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 
        0 2px 6px rgba(59, 130, 246, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

#brush-size::-ms-thumb {
    width: 24px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 
        0 2px 6px rgba(59, 130, 246, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

button:hover {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.95));
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-2px) scale(1.08);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

button:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        0 3px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 撤销按钮特殊样式 */
#undo-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(148, 163, 184, 0.1) !important;
    transform: none !important;
}

#undo-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(148, 163, 184, 0.1) !important;
    transform: none !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

#undo-btn:not(:disabled) {
    opacity: 1 !important;
}

/* 状态信息 */
#status {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 10px 20px;
    z-index: 1000;
    text-align: center;
    font-size: 12px;
}

#gyro-status {
    color: #00f5ff;
    margin-bottom: 5px;
}

#draw-status {
    color: #ff00ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        padding: 12px 20px;
    }
    
    .toolbar-content {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* 平板端画笔工具组 */
    .brush-group {
        gap: 10px;
    }
    
    .brush-buttons {
        gap: 6px;
    }
    
    /* 平板端颜色控制组 */
    .color-control {
        gap: 6px;
    }
    
    #brush-color, #bg-color {
        width: 24px;
        height: 24px;
    }
    
    /* 平板端功能按钮组 */
    .function-buttons {
        gap: 6px;
    }
    
    /* 平板端滑块控件 */
    .size-control-horizontal {
        height: 32px;
        padding: 4px 12px;
        border-radius: 10px;
    }
    
    #brush-size {
        width: 100%;
    }
    
    /* 平板端按钮尺寸 */
    .brush-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
    }
    
    /* 平板端图标尺寸 */
    .brush-btn .icon,
    .layer-control-btn .icon {
        width: 16px;
        height: 16px;
    }
    
    /* 平板端拉柄样式 */
    .panel-handle {
        width: 100px;
        height: 28px;
    }
    
    .layer-panel {
        padding: 16px 20px;
    }
    
    .layer-list {
        gap: 14px;
        padding: 6px 10px;
    }
    
    .layer-item {
        padding: 12px 8px;
        gap: 6px;
        min-width: 80px;
        max-width: 80px;
    }
    
    /* 平板端操作区域 */
    .layer-operations,
    .panel-actions {
        gap: 6px;
    }
    
    /* 平板端分隔线 */
    .layer-divider {
        width: 18px;
        margin: 3px 0;
    }
    
    /* 平板端layer控制按钮 */
    .layer-control-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .layer-preview {
        width: 50px;
        height: 65px;
    }
    
    .layer-info {
        font-size: 11px;
    }
    
    #status {
        bottom: 10px;
        font-size: 11px;
    }
    
    #brush-size::-webkit-slider-thumb {
        width: 20px;
        height: 30px;
    }
    #brush-size::-moz-range-thumb {
        width: 20px;
        height: 30px;
    }
    #brush-size::-ms-thumb {
        width: 20px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .toolbar {
        padding: 10px 16px;
    }
    
    .toolbar-content {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* 手机端画笔工具组 */
    .brush-group {
        gap: 8px;
    }
    
    .brush-buttons {
        gap: 4px;
    }
    
    /* 手机端颜色控制组 */
    .color-control {
        gap: 6px;
    }
    
    #brush-color, #bg-color {
        width: 20px;
        height: 20px;
    }
    
    /* 手机端功能按钮组 */
    .function-buttons {
        gap: 4px;
    }
    
    /* 手机端滑块控件 */
    .size-control-horizontal {
        height: 28px;
        padding: 3px 8px;
        border-radius: 8px;
    }
    
    #brush-size {
        width: 100%;
        height: 3px;
    }
    
    /* 手机端滑块thumb样式调整 */
    #brush-size::-webkit-slider-thumb {
        width: 18px;
        height: 26px;
    }
    
    #brush-size::-moz-range-thumb {
        width: 18px;
        height: 26px;
    }
    
    #brush-size::-ms-thumb {
        width: 18px;
        height: 26px;
    }
    
    /* 手机端按钮尺寸 */
    .brush-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
    }
    
    /* 手机端图标尺寸 */
    .brush-btn .icon,
    .layer-control-btn .icon {
        width: 14px;
        height: 14px;
    }
    
    /* 手机端拉柄样式 */
    .panel-handle {
        width: 80px;
        height: 26px;
    }
    
    .handle-grip {
        width: 30px;
        height: 4px;
    }
    
    .handle-grip::before,
    .handle-grip::after {
        width: 30px;
        height: 2px;
    }
    
    .layer-panel {
        padding: 14px 16px;
    }
    
    .layer-list {
        gap: 12px;
        padding: 4px 8px;
    }
    
    .layer-item {
        padding: 10px 6px;
        gap: 4px;
        min-width: 70px;
        max-width: 70px;
    }
    
    .layer-preview {
        width: 45px;
        height: 60px;
    }
    
    /* 手机端操作区域 */
    .layer-operations,
    .panel-actions {
        gap: 4px;
    }
    
    /* 手机端分隔线 */
    .layer-divider {
        width: 16px;
        margin: 2px 0;
    }
    
    /* 手机端layer控制按钮 */
    .layer-control-btn {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .layer-info {
        font-size: 10px;
    }
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 245, 255, 0.3);
    border-top: 4px solid #00f5ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 画笔预览 */
#brush-preview {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    background: rgba(0, 245, 255, 0.5);
    border: 2px solid #00f5ff;
    z-index: 999;
    display: none;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
}

/* 透视线段样式 */
#perspective-lines {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease;
}

.perspective-line {
    /* 透视线基础样式 */
} 

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content {
    position: relative;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    transform: scale(0.85) translateY(30px) rotateX(10deg);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(20px);
}

.modal.show .modal-content {
    transform: scale(1) translateY(0) rotateX(0deg);
    opacity: 1;
}



/* 图片导入overlay样式 */
.image-import-overlay {
    border-radius: 12px;
}

/* 图片导入控制面板样式 */
.image-import-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 24px;
    z-index: 1003;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 -10px 40px rgba(0, 0, 0, 0.3),
        0 -4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.image-import-panel.show {
    transform: translateY(0);
}

.image-import-header {
    text-align: center;
    margin-bottom: 20px;
}

.image-import-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.4;
}



.image-import-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.image-import-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.image-import-btn.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border-color: rgba(59, 130, 246, 1);
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: white;
}

.image-import-btn.primary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    transform: translateY(-2px);
    box-shadow: 
        0 0 32px rgba(59, 130, 246, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.image-import-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.image-import-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px);
}

.image-import-btn:active {
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .image-import-panel {
        padding: 16px 12px; /* 减少padding */
    }
    
    .image-import-header {
        margin-bottom: 16px; /* 减少间距 */
    }
    
    .image-import-header p {
        font-size: 13px; /* 减小字体 */
    }
    
    .image-import-actions {
        flex-direction: row; /* 保持水平排列 */
        gap: 8px;
    }
    
    .image-import-btn {
        padding: 8px 12px; /* 减少padding */
        font-size: 13px; /* 减小字体 */
        border-radius: 8px; /* 减小圆角 */
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.thanks-image {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
}

.modal-body p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .thanks-image {
        max-width: 250px;
        max-height: 250px;
    }
    
    .modal-body p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 98%;
        max-height: 98%;
    }
    
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-header h3 {
        font-size: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .thanks-image {
        max-width: 220px;
        max-height: 220px;
    }
    
    .modal-body p {
        font-size: 12px;
    }
}

/* 导出模态框特殊样式 */
.export-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    min-width: 400px;
}

/* 设置模态框特殊样式 */
.settings-modal-content {
    max-width: 600px;
    max-height: 85vh;
    width: 90vw;
    min-width: 350px;
}

/* 设置容器 */
.settings-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 450px;
}

/* 设置标签页 */
.settings-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 25px;
    margin-bottom: 0;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-tab {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    backdrop-filter: blur(10px);
    flex: 1;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-tab:hover {
    color: rgba(255, 255, 255, 0.95);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.settings-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #00f5ff, #0099cc);
    border-color: rgba(0, 245, 255, 0.5);
    box-shadow: 
        0 4px 20px rgba(0, 245, 255, 0.3),
        0 0 0 1px rgba(0, 245, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.settings-tab.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, #00f5ff, #0099cc);
    border-radius: 12px;
    z-index: -1;
    opacity: 0.1;
    animation: tabGlow 2s ease-in-out infinite alternate;
}

@keyframes tabGlow {
    0% {
        opacity: 0.1;
        transform: scale(1);
    }
    100% {
        opacity: 0.2;
        transform: scale(1.02);
    }
}

/* 设置内容区域 */
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* 设置面板 */
.settings-panel {
    display: none;
    padding: 25px;
    animation: fadeIn 0.3s ease;
}

.settings-panel.active {
    display: block;
}

.settings-panel h4 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 设置组 */
.settings-group {
    margin-bottom: 20px;
}

.settings-group:last-child {
    margin-bottom: 0;
}



/* 设置标签 */
.settings-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    cursor: pointer;
    gap: 20px;
    flex-wrap: nowrap;
    min-height: 40px;
}

.settings-label span:first-child {
    flex: 1;
    text-align: left;
    line-height: 1.4;
    min-width: 0;
}

.settings-value {
    color: #ffffff;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* 设置输入控件 */
.settings-label input[type="range"] {
    flex: 0 0 120px;
    margin: 0 10px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    border-radius: 10px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.settings-label input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 2px solid rgba(59, 130, 246, 1);
    cursor: pointer;
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.settings-label input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    box-shadow: 
        0 0 16px rgba(59, 130, 246, 0.6),
        0 3px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Firefox support */
.settings-label input[type="range"]::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 2px solid rgba(59, 130, 246, 1);
    cursor: pointer;
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.settings-label input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    box-shadow: 
        0 0 16px rgba(59, 130, 246, 0.6),
        0 3px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.settings-label input[type="range"]::-moz-range-track {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    border-radius: 10px;
    height: 4px;
    border: none;
}

.settings-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    appearance: none;
    border: 2px solid rgba(59, 130, 246, 0.5);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.settings-label input[type="checkbox"]:checked {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border-color: rgba(59, 130, 246, 1);
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.settings-label input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.settings-label input[type="checkbox"]:hover {
    border-color: rgba(59, 130, 246, 0.8);
    transform: scale(1.05);
}



/* 设置按钮 */
.settings-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 1px solid rgba(59, 130, 246, 1);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    min-width: 160px;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.settings-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    border-color: rgba(59, 130, 246, 1);
    transform: translateY(-1px);
    box-shadow: 
        0 0 32px rgba(59, 130, 246, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.settings-btn:active {
    transform: translateY(0);
}

.import-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border-color: rgba(59, 130, 246, 1);
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.import-export-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    border-color: rgba(59, 130, 246, 1);
    transform: translateY(-1px);
    box-shadow: 
        0 0 32px rgba(59, 130, 246, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.import-export-btn .icon {
    width: 16px;
    height: 16px;
}



/* 支持内容 */
.support-content {
    text-align: center;
    margin-bottom: 20px;
}

.support-content .thanks-image {
    max-width: 250px;
    max-height: 250px;
    margin-bottom: 15px;
}

.support-content p {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .settings-modal-content {
        min-width: 300px;
        max-height: 90vh;
    }
    
    .settings-tabs {
        padding: 8px 15px;
        gap: 6px;
    }
    
    .settings-tab {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }
    
    .settings-panel {
        padding: 20px;
    }
    
    .settings-label {
        gap: 15px;
        font-size: 13px;
    }
    
    .settings-label input[type="range"] {
        flex: 0 0 100px;
        margin: 0 8px;
    }
    
    .settings-value {
        min-width: 35px;
        font-size: 13px;
    }
    
    .support-content .thanks-image {
        max-width: 200px;
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .settings-modal-content {
        min-width: 280px;
        max-height: 95vh;
    }
    
    .settings-tabs {
        padding: 6px 10px;
        gap: 4px;
    }
    
    .settings-tab {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .settings-panel {
        padding: 15px;
    }
    
    .settings-panel h4 {
        font-size: 15px;
    }
    
    .settings-label {
        font-size: 12px;
        gap: 10px;
    }
    
    .settings-label input[type="range"] {
        flex: 0 0 80px;
        margin: 0 6px;
    }
    
    .settings-btn,
    .import-export-btn {
        padding: 8px 16px;
        font-size: 12px;
        min-width: 120px;
    }
    
    .settings-value {
        min-width: 30px;
        font-size: 12px;
    }
    
    .support-content .thanks-image {
        max-width: 180px;
        max-height: 180px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 通知动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Pickr颜色选择器自定义样式 */
/* 隐藏Pickr创建的按钮 */
.pickr-hidden-container .pcr-button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.pickr-hidden-container {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

.pcr-app {
    position: fixed !important;
    width: 280px !important;
    max-width: 95vw !important;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95)) !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    border-radius: 16px !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    z-index: 10000 !important;
    top: 80px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.pcr-app .pcr-palette {
    width: 100% !important;
    height: 180px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.pcr-app .pcr-slider {
    height: 12px !important;
    border-radius: 6px !important;
    margin: 8px 0 !important;
}

.pcr-app .pcr-slider .pcr-picker {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.pcr-app .pcr-interaction {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    padding: 6px 9px !important;
    justify-content: center !important;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
}

/* 隐藏不需要的组件 */
.pcr-app .pcr-interaction .pcr-result,
.pcr-app .pcr-interaction .pcr-type {
    display: none !important;
}

.pcr-app .pcr-interaction .pcr-save,
.pcr-app .pcr-interaction .pcr-cancel {
    margin-top: 0px !important;
    display: inline-block !important;
    background: linear-gradient(135deg, #00f5ff, #0099cc) !important;
    border: none !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    text-transform: none !important;
}

.pcr-app .pcr-interaction .pcr-cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

.pcr-app .pcr-interaction .pcr-save:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(0, 245, 255, 0.3) !important;
}

.pcr-app .pcr-interaction .pcr-cancel:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .pcr-app {
        width: 260px !important;
        max-width: 90vw !important;
        top: 70px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    .pcr-app .pcr-palette {
        height: 150px !important;
    }
    
    .pcr-app .pcr-interaction {
        padding: 10px 12px !important;
    }
}

.export-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.export-preview-image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.05);
    /* 近邻插值模式，保持像素锐利 */
    /* image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast; */
}

.export-info {
    text-align: center;
    margin-bottom: 20px;
}

.export-info p {
    color: #ccc;
    font-size: 14px;
    margin: 0;
}

.export-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.export-action-btn.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    border: 1px solid rgba(59, 130, 246, 1);
    color: white;
    box-shadow: 
        0 0 24px rgba(59, 130, 246, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.export-action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(147, 51, 234, 1));
    transform: translateY(-2px);
    box-shadow: 
        0 0 32px rgba(59, 130, 246, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.export-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

@media (max-width: 768px) {
    .export-modal-content {
        min-width: 320px;
        max-width: 95vw;
    }
    
    .export-preview-image {
        max-height: 300px;
    }
    
    .export-actions {
        flex-direction: column;
    }
    
    .export-action-btn {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .export-modal-content {
        min-width: 280px;
    }
    
    .export-preview-image {
        max-height: 250px;
    }
    
    .export-info p {
        font-size: 13px;
    }
    
    .export-action-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* SVG图标样式 */
.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none; /* 确保点击事件传递给按钮 */
}

/* 按钮中的图标样式 */
.brush-btn .icon,
.layer-control-btn .icon {
    width: 18px;
    height: 18px;
}

/* 陀螺仪按钮图标特殊处理 */
.gyro-btn .icon {
    width: 18px;
    height: 18px;
}

/* 确保按钮内容居中 */
.brush-btn,
.layer-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 开屏界面样式 */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: white;
    animation: splashFadeIn 0.8s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px auto;
    filter: drop-shadow(0 8px 24px rgba(192, 80, 153, 0.3));
    animation: splashFadeIn 0.8s ease-out;
}

.splash-logo-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(192,80,153,0.18);
    background: transparent;
    object-fit: contain;
}

.splash-title {
    font-size: 4rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: splashFadeIn 0.8s ease-out;
}

.splash-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.1em;
    animation: splashFadeIn 0.8s ease-out;
}

@keyframes splashFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 响应式适配 */
@media (max-width: 768px) {
    .splash-logo {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }
    
    .splash-title {
        font-size: 3rem;
    }
    
    .splash-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .splash-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
    }
    
    .splash-title {
        font-size: 2.5rem;
    }
    
    .splash-subtitle {
        font-size: 0.9rem;
    }
}

/* ===================================
   眼睛追踪相关样式
   =================================== */

/* 眼睛追踪状态消息（简洁版） */
.eye-tracking-status-message {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(139, 92, 246, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 24px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    animation: eyeTrackingSlideIn 0.3s ease-out;
    transition: opacity 0.3s ease-out;
}

.status-icon {
    font-size: 1.2rem;
    animation: eyeTrackingPulse 2s ease-in-out infinite;
}

.status-text {
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

/* 校准成功消息 */
.calibration-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    z-index: 10001;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    display: none;
    transition: opacity 0.3s ease;
}

/* 眼睛追踪错误提示 */
.eye-tracking-error {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    display: none;
    max-width: 90%;
    text-align: center;
}

/* 眼睛追踪动画 */
@keyframes eyeTrackingSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes eyeTrackingPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .eye-tracking-status-message {
        top: 60px;
        padding: 10px 20px;
        max-width: 90%;
    }

    .status-text {
        font-size: 0.9rem;
    }
}

