* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: rgb(38 38 36);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
}

.btn-secondary {
    background: linear-gradient(45deg, #4834d4, #686de0);
    border: none;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    transition: right 0.3s ease;
    z-index: 1001;
    padding: 2rem;
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.settings-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    line-height: 30px;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    font-size: 1.2rem;
    width: 30px;
    border-radius: 50%;
    transition: all 0.2s ease;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 0.5rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.setting-value {
    font-size: 0.9rem;
    color: #666;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    background: rgb(0, 0, 0);
}

.upload-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 300px;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%) scale(1.05);
}

.upload-area.dragover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.upload-icon {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
}

.upload-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-align: center;
}

#fileInput {
    display: none;
}

#sourceImage {
    display: none;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4834d4);
    background: rgb(38 38 36);
    transition: width 0.3s ease;
    z-index: 1000;
    width: 0%;
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .settings-panel {
        width: 100vw;
        right: -100vw;
    }

    .upload-area {
        width: 90vw;
        height: 200px;
    }

    .canvas-container {
        padding: 1rem;
    }
}
