:root {
    --bg-color: #0F0F0F;
    --bg-color-rgb: 15, 15, 15;
    --image-list-bg: #1A1A1A;
    --image-list-bg-rgb: 26, 26, 26;
    --text-color: #FFFFFF;
    --text-color-rgb: 255, 255, 255;
    --text-secondary: #ABABAB;
    --text-secondary-rgb: 171, 171, 171;
    --border-color: #333333;
    --border-color-rgb: 51, 51, 51;
    --particle-dark: #0F0F0F;
    --particle-dark-rgb: 15, 15, 15;
    --particle-light: #18D1FF;
    --particle-light-rgb: 24, 209, 255;
    --hover-bg: #2A2A2A;
    --hover-bg-rgb: 42, 42, 42;
    --component-bg: #1A1A1A;
    --component-bg-rgb: 26, 26, 26;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

/* 应用容器 */
.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 标题样式 */
.app-header {
    width: 100%;
    max-width: 95vw;
    margin-bottom: 15px;
    position: relative;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.app-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(var(--particle-light-rgb), 0.3);
}

.app-title span {
    font-size: 20px;
    font-weight: 400;
}

.title-sub {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 1px;
    /* margin-left: 10px; */
}

/* 导航链接样式 */
.header-links {
    display: flex;
    gap: 20px;
    white-space: nowrap;
    align-items: stretch;
    margin-right: 20px;
}

.header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    padding: 4px 8px;
    background-color: rgba(var(--text-secondary-rgb), 0.1);
    border-radius: 8px;
}

.header-link img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.header-link:hover {
    color: var(--text-color);
    background: rgba(var(--particle-light-rgb), 0.4);
}

.header-line {
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, var(--particle-light), transparent);
    margin-top: 8px;
    opacity: 0.6;
}

/* 粒子组件 */
.dpis-playground {
    width: 100%;
    max-width: 95vw;
    flex: 1; /* 占据剩余空间 */
    display: flex;
    background: var(--component-bg);
    background-image: url('../public/cross200xl.png');
    background-repeat: repeat;
    background-position: center;
    background-size: 200px 200px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* 图片栏 */
.image-list {
    width: 200px;
    background: rgba(var(--image-list-bg-rgb), 0.8);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 图片项 */
.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.image-item:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.demo-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-color);
    margin-bottom: 8px;
}

.image-name {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* 上传项特定样式 */
.upload-item {
    border: 2px dashed var(--border-color);
    background: transparent;
    justify-content: center;
    min-height: 150px;
}

.upload-item:hover {
    border-color: var(--particle-light);
    color: var(--particle-light);
    background: rgba(var(--particle-light-rgb), 0.05);
}

.upload-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.upload-item:hover .upload-icon {
    color: var(--particle-light);
}

/* 画布区域 */
.canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-color-rgb), 0.6);
    padding: 20px;
    min-width: 0;
}

#dpis-canvas {
    background: rgba(var(--component-bg-rgb), 0.8);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(var(--particle-light-rgb), 0.1);
    max-width: 100%;
    max-height: 100%;
    touch-action: none; /* 禁用画布上的默认触摸行为，如缩放和滚动 */
}

/* 控制面板 */
.controls-panel {
    width: 250px;
    background: rgba(var(--image-list-bg-rgb), 0.8);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 控制项 */
.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 标签行 */
.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 标签 */
.label-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
}

/* 数值显示 */
.value-display {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 600;
    background-color: rgba(var(--text-secondary-rgb), 0.1);
    padding: 2px 8px;
    min-width: 45px;
    text-align: center;
    font-style: italic;
}

/* 下拉选择框样式 */
select {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none; /* 移除默认箭头 */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2318D1FF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

select:hover {
    border-color: var(--particle-light);
    background-color: var(--hover-bg);
}

select:focus {
    border-color: var(--particle-light);
    box-shadow: 0 0 0 2px rgba(24, 209, 255, 0.2);
}

select option {
    background-color: var(--image-list-bg);
    color: var(--text-color);
    padding: 8px;
}

/* 滑块样式 */
input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--particle-light);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(var(--particle-light-rgb), 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--particle-light);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(var(--particle-light-rgb), 0.4);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(var(--particle-light-rgb), 0.6);
}

/* 响应式适配 */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .app-container {
        padding: 10px;
        min-height: 100vh;
    }

    .app-title {
        font-size: 20px;
        font-weight: 500;
        letter-spacing: 1px;
    }

    .app-title span {
        font-size: 10px;
        font-weight: 200;
    }

    .header-links {
        margin-right: 0px;
    }
    
    .header-link img {
        width: 15px;
        height: 15px;
    }

    .dpis-playground {
        flex-direction: column;
        overflow-y: visible;
    }

    .image-list, .controls-panel {
        width: 100%;
        height: auto;
        border: none;
        background: rgba(var(--image-list-bg-rgb), 0.9);
    }

    .image-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
        min-height: 125px;
    }

    .upload-item {
        min-height: auto;
    }

    .image-item {
        min-width: 100px;
        flex-shrink: 0;
    }

    .demo-image {
        height: 60px;
    }

    .canvas-area {
        padding: 10px;
        min-height: 300px;
    }

    .controls-panel {
        border-top: 1px solid var(--border-color);
        overflow-y: visible;
        padding: 15px;
    }

    input[type="range"], select {
        width: 65%;
    }
}

.image-list,
.controls-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

.image-list::-webkit-scrollbar,
.controls-panel::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

.image-list::-webkit-scrollbar-track,
.controls-panel::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.image-list::-webkit-scrollbar-thumb,
.controls-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.image-list::-webkit-scrollbar-thumb:hover,
.controls-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
