* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px 20px;
}

.header {
    text-align: left;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    color: #666;
}

.main-content {
    display: flex;
    gap: 25px;
    align-items: stretch;
}

/* 左侧功能面板 */
.controls-panel {
    width: 280px;
    border: 1px solid #ddd;
    padding: 20px;
    background: #fff;
    flex-shrink: 0;
}

/* 右侧区域按钮 */
.area-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.area-buttons .btn {
    width: auto;
    min-width: 120px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    pointer-events: auto;
}

.area-buttons .btn-outline {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}

.area-buttons .btn-outline:hover {
    background: #000;
    color: #fff;
}

/* 右侧区域 */
.upload-preview-area {
    flex: 1;
    border: 2px dashed #ccc;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    position: relative;
    min-height: 600px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-preview-area:hover {
    border-color: #999;
    background: #f5f5f5;
}

.upload-preview-area.has-image {
    border: 1px solid #ddd;
    cursor: default;
    background: #f9f9f9;
}

.upload-preview-area.has-image:hover {
    border-color: #ddd;
    background: #f9f9f9;
}

/* 上传区域和预览区域共享同一个容器 */
.upload-section,
.preview-section {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    padding: 40px;
    box-sizing: border-box;
}

.upload-section {
    z-index: 2;
}

.preview-section {
    z-index: 1;
}

.drop-zone {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: none;
    background: transparent;
    margin: 0;
    padding: 40px;
    box-sizing: border-box;
}

.drop-zone p {
    margin: 0;
    color: #666;
    font-size: 18px;
    pointer-events: none;
}

.drop-zone p:first-child {
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    font-size: 20px;
}

.drop-zone input[type="file"] {
    display: none;
}

/* 预览区域 */
.preview-section {
    z-index: 1;
    background: #fff;
}

.preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-placeholder {
    color: #999;
    font-size: 16px;
    text-align: center;
    font-weight: 500;
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* 隐藏状态 */
.upload-section.hidden {
    display: none;
}

.preview-section.hidden {
    display: none;
}

/* 控制组样式 */
.watermark-controls h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #000;
}

.control-group input[type="range"] {
    width: calc(100% - 55px);
    margin: 8px 0;
    -webkit-appearance: none;
    height: 4px;
    background: #ddd;
    outline: none;
    display: inline-block;
    vertical-align: middle;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #666;
    cursor: pointer;
    border-radius: 50%;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #666;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.control-group span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    display: inline-block;
    min-width: 40px;
    text-align: right;
    margin-left: 10px;
    vertical-align: middle;
}

.control-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    font-size: 14px;
    border-radius: 0;
    transition: all 0.2s;
    height: 40px;
    box-sizing: border-box;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.control-group input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 0;
    padding-inline: 1px;
}

.control-group input[type="range"] {
    width: calc(100% - 55px);
    margin: 8px 0;
    -webkit-appearance: none;
    height: 4px;
    background: #ddd;
    outline: none;
    display: inline-block;
    vertical-align: middle;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #666;
    cursor: pointer;
    border-radius: 50%;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #666;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.control-group span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    display: inline-block;
    min-width: 40px;
    text-align: right;
    margin-left: 10px;
    vertical-align: middle;
}

/* 模式选择 */
.mode-selection {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.mode-btn {
    flex: 1;
    padding: 8px 6px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    color: #333;
}

.mode-btn:hover {
    border-color: #999;
    background: #f0f0f0;
}

.mode-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: #333;
}

.radio-label input[type="radio"] {
    margin: 0;
    transform: scale(1.1);
}

/* 位置选择网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.position-btn {
    padding: 8px 6px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    color: #333;
}

.position-btn:hover {
    border-color: #999;
    background: #f0f0f0;
}

.position-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* 按钮样式 */
.btn {
    padding: 0 20px;
    border: none;
    background: #000;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: #333;
}

.btn-primary {
    background: #000;
    color: #fff;
    margin-bottom: 12px;
}

.btn-primary:hover {
    background: #333;
}

.btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls-panel {
        width: 100%;
        order: 2;
        padding: 15px;
    }
    
    .upload-preview-area {
        order: 1;
        min-height: 300px;
    }
    
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .header p {
        font-size: 13px;
    }
    
    .drop-zone {
        padding: 40px 15px;
        margin: 20px;
    }
    
    .drop-zone p:first-child {
        font-size: 14px;
    }
    
    .position-grid {
        gap: 4px;
    }
    
    .position-btn {
        padding: 6px 4px;
        font-size: 11px;
    }
    
    .mode-selection {
        gap: 12px;
    }
    
    .radio-label {
        font-size: 13px;
    }
}