* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.upload-section {
    text-align: center;
    margin-bottom: 30px;
}

#imageUpload {
    display: none;
}

.upload-section label {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.upload-section label:hover {
    background-color: #45a049;
}

.preview-section {
    margin-bottom: 30px;
}

.preview-section h2 {
    margin-bottom: 15px;
    color: #555;
}

/* 完全重构预览区域样式 */
.original-preview {
    width: 100%;
    height: 300px;
    border: 2px dashed #ccc;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 预览图片样式 - 确保覆盖整个容器 */
#originalImage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none; /* 默认隐藏 */
    z-index: 2; /* 确保在提示文字上方 */
}

/* 提示文字容器 - 居中显示 */
.upload-hint-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* 提示文字样式 */
.upload-hint {
    color: #999;
    text-align: center;
    padding: 0 20px;
    margin: 0;
}

/* 有图片时的状态 */
.original-preview.has-image #originalImage {
    display: block; /* 显示图片 */
}

.original-preview.has-image .upload-hint-container {
    display: none; /* 隐藏提示文字容器 */
}

/* 悬停效果 */
.original-preview:not(.has-image):hover {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.05);
}

.original-preview.dragover {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

.original-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#originalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.grid-preview-section h2 {
    margin-bottom: 15px;
    color: #555;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.grid-item {
    width: 100%;
    aspect-ratio: 1/1;
    border: 1px solid #eee;
    overflow: hidden;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.button-group {
    display: flex;
    gap: 15px;
}

.download-btn, .clear-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.download-btn {
    background-color: #2196F3;
    color: white;
}

.clear-btn {
    background-color: #f44336;
    color: white;
}

.download-btn:disabled, .clear-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.download-btn:hover:not(:disabled) {
    background-color: #0b7dda;
}

.clear-btn:hover:not(:disabled) {
    background-color: #da190b;
}