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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 30px 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3);
}

h1 {
    text-align: center;
    color: #1a1a2e;
    font-size: 2rem;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1rem;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 20px;
    padding: 70px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbff;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #764ba2;
    background: #f3f0ff;
    transform: scale(1.01);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.upload-content p {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.upload-content span {
    color: #999;
    font-size: 14px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 16px;
}

/* Preview */
.preview-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 40px 0;
}

.preview-box {
    text-align: center;
}

.preview-box h3 {
    margin-bottom: 15px;
    color: #444;
    font-size: 16px;
    font-weight: 600;
}

.preview-box img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    object-fit: contain;
}

.result-wrapper {
    background: repeating-conic-gradient(#e0e0e0 0% 25%, white 0% 50%) 0 0 / 20px 20px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.result-wrapper img {
    border-radius: 12px;
    box-shadow: none;
    display: block;
}

/* Actions */
.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

button {
    padding: 14px 35px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102,126,234,0.5);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Error */
.error {
    background: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 12px;
    padding: 15px 20px;
    margin-top: 20px;
    text-align: center;
    color: #cc3333;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    color: #aaa;
    font-size: 13px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

@media (max-width: 600px) {
    .container { padding: 30px 20px; }
    .preview-area { grid-template-columns: 1fr; }
    h1 { font-size: 1.5rem; }
}
