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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    min-height: 100vh;
    height: 100vh;
    padding: 20px;
    color: #333;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 1100px;
    width: 100%;
    height: 100%;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 25px;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 300;
}

.main-content {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
    overflow: hidden;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-card {
    position: relative;
    flex: 1;
    min-height: 0;
}

.upload-area {
    border: 3px dashed #e5e7eb;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.upload-area:hover {
    border-color: #8b5cf6;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
}

.upload-area:hover::before {
    opacity: 1;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #a78bfa;
    margin-bottom: 12px;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.upload-area:hover .upload-icon {
    color: #8b5cf6;
    transform: scale(1.1);
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #9ca3af;
}

.preview-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    padding: 12px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #f3f4f6;
}

.preview-container img {
    max-width: 140px;
    max-height: 140px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.remove-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}


.result-section {
    display: flex;
    flex-direction: column;
}

.result-card {
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.result-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.canvas-container {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid #f3f4f6;
    position: relative;
    min-height: 300px;
}

.canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.canvas-placeholder {
    text-align: center;
    color: #9ca3af;
    position: relative;
    z-index: 1;
}

.canvas-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.canvas-placeholder p {
    font-size: 0.95rem;
    margin: 0;
}

#resultCanvas {
    max-width: 280px;
    max-height: 280px;
    height: auto;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    display: none;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#resultCanvas.show {
    display: block;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.generate-btn,
.download-btn,
.copy-btn {
    padding: 11px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.generate-btn {
    width: 100%;
    margin-bottom: 10px;
}

.download-btn,
.copy-btn {
    flex: 1;
}

.generate-btn::before,
.download-btn::before,
.copy-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.generate-btn:hover::before,
.download-btn:hover::before,
.copy-btn:hover::before {
    width: 300px;
    height: 300px;
}

.generate-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.generate-btn:disabled {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    cursor: not-allowed;
    box-shadow: none;
}

.download-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.download-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.copy-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.copy-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

@media (max-width: 1000px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        overflow-y: auto;
    }

    .upload-section {
        flex-direction: row;
        gap: 15px;
    }

    body {
        overflow: auto;
        height: auto;
    }

    .container {
        height: auto;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .upload-section {
        flex-direction: column;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .control-group label {
        min-width: auto;
    }

    .control-group input[type="range"] {
        width: 100%;
    }
}

