:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.15);
    --text-light: #f8fafc;
    --button-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e293b);
    --shadow: rgba(99, 102, 241, 0.3);
    --accent: #22d3ee;
}

:root[data-theme="dark"] {
    --primary: #7C4DFF;
    --secondary: #448AFF;
    --bg-primary: #1A1A2E;
    --bg-secondary: #16213E;
    --glass: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.12);
    --text: #ffffff;
    --text-secondary: #a8b1ff;
    --button-gradient: linear-gradient(45deg, #7C4DFF, #448AFF);
    --bg-gradient: linear-gradient(45deg, #1A1A2E, #16213E);
    --shadow: rgba(124, 77, 255, 0.3);
    --accent: #22d3ee;
}

:root[data-theme="light"] {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --glass: rgba(0, 0, 0, 0.05);
    --glass-hover: rgba(0, 0, 0, 0.08);
    --text: #1e293b;
    --text-secondary: #4b5563;
    --button-gradient: linear-gradient(45deg, #6366f1, #8b5cf6);
    --bg-gradient: linear-gradient(45deg, #ffffff, #f1f5f9);
    --shadow: rgba(99, 102, 241, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text);
    padding: 20px;
    overflow: auto;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
    background: var(--glass);
    border: none;
    color: var(--text);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle i {
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
}

h1 {
    text-align: center;
    margin: 20px 0 40px;
    font-size: 2.5rem;
    color: var(--text);
    text-shadow: 0 0 20px var(--shadow);
}

.content-wrapper {
    display: flex;
    gap: 30px;
    height: calc(100vh - 120px);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.left-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.right-section {
    flex: 1;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 24px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    overflow: hidden;
    margin: 10px 0;
}

#imagePreview {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 12px;
}

#canvas {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

p {
    background: rgba(12, 12, 44, 0.3);
    width: 100%;
    padding: 18px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    margin-bottom: 15px;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

p strong {
    color: var(--text);
}

.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

input[type="file"] {
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.button-container {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

button {
    padding: 14px;
    background: var(--button-gradient);
    border: none;
    border-radius: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
}

span {
    color: var(--text-secondary);
    margin-left: 10px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--glass);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .left-section,
    .right-section {
        width: 100%;
    }
}