:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111115;
    --glass-bg: rgba(26, 26, 32, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --gradient-primary: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    --radius-xl: 20px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 2rem;
}

.background-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.15), transparent 40%),
                radial-gradient(circle at 85% 75%, rgba(6, 182, 212, 0.15), transparent 40%);
}

.site-header { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 700; font-size: 1.25rem; background: var(--gradient-primary); -webkit-background-clip: text; color: transparent; }
.steps-indicator { color: var(--text-secondary); font-size: 0.9rem; }
.steps-indicator span.active { color: var(--text-primary); font-weight: 600; }
.divider { margin: 0 0.5rem; opacity: 0.3; }

.app-container {
    width: 100%; max-width: 1100px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 2rem; padding: 0 1rem;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
}

.glass-card h2 { margin-bottom: 0.5rem; }
.glass-card p { color: var(--text-secondary); margin-bottom: 2rem; }
.hidden { display: none !important; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.upload-box {
    background: rgba(255,255,255,0.03); border-radius: var(--radius-md);
    padding: 2rem; border: 1px dashed var(--glass-border);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.upload-box h3 { margin-bottom: 1rem; }

.file-input { display: none; }
.status-text { display: block; margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); }

.alignment-container { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-bottom: 1.5rem; }
.canvas-wrapper {
    position: relative; border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); overflow: hidden; background: #000;
}
.canvas-wrapper canvas { display: block; max-width: 100%; height: auto; cursor: crosshair; }
.label-badge {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,0.7); padding: 4px 8px;
    border-radius: 4px; font-size: 0.75rem; pointer-events: none;
}

.relative-container {
    background: #111; border-radius: var(--radius-md);
    border: 1px solid var(--glass-border); overflow: hidden;
}
#canvas-composite { display: block; width: 100%; height: auto; cursor: none; }

.controls-bar {
    display: flex; justify-content: center; align-items: center; gap: 1.5rem;
    flex-wrap: wrap; margin-top: 1.5rem;
    background: rgba(0,0,0,0.2); padding: 1rem; border-radius: var(--radius-md);
}
.control-group { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.control-group label { font-size: 0.8rem; color: var(--text-secondary); }

/* Range Slider Styles */
input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100px; height: 4px; background: var(--glass-border);
    border-radius: 5px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-primary); cursor: pointer;
}

/* Buttons */
.action-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: var(--gradient-primary); border: none; color: white;
    padding: 0.8rem 2rem; border-radius: var(--radius-md);
    font-weight: 600; cursor: pointer; transition: transform 0.2s, background 0.2s;
    min-width: 180px;
    text-align: center;
}
.action-btn:hover:not(:disabled) { transform: scale(1.05); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
.action-btn.secondary { background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); }
.action-btn.secondary:hover { background: rgba(255,255,255,0.15); }
.action-btn.small-btn { padding: 0.5rem 1rem; font-size: 0.9rem; min-width: auto; }

.tool-select { display: flex; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 2px; }
.tool-btn {
    background: transparent; border: none; color: var(--text-secondary);
    padding: 0.5rem 1rem; cursor: pointer; border-radius: 6px;
}
.tool-btn.active { background: var(--bg-secondary); color: white; }

/* --- MAGNIFIER LENS --- */
.magnifier-lens {
    position: fixed;
    z-index: 10000;
    border: 3px solid var(--accent-cyan);
    border-radius: 50%; /* Circular */
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background-color: #000;
    pointer-events: none; /* CRITICAL: Allows clicks to pass through to the canvas below */
    display: none; /* Hidden via JS */
    cursor: none;
}

.magnifier-lens.active {
    display: block;
}

/* Custom Cursor */
.brush-cursor {
    position: fixed; pointer-events: none; z-index: 9999;
    border: 2px solid white; border-radius: 50%;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference; display: none;
}

/* Toggle Switch */
.toggle-switch { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; font-size: 0.9rem; color: var(--text-secondary); }
.toggle-switch input[type="checkbox"] { display: none; }
.toggle-switch .toggle-knob { position: relative; width: 44px; height: 24px; background-color: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: 12px; transition: background-color 0.3s ease; }
.toggle-switch .toggle-knob::before { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background-color: var(--text-secondary); border-radius: 50%; transition: transform 0.3s ease, background-color 0.3s ease; }
.toggle-switch input[type="checkbox"]:checked + .toggle-knob { background-color: var(--accent-cyan); }
.toggle-switch input[type="checkbox"]:checked + .toggle-knob::before { transform: translateX(20px); background-color: white; }

.mt-2 { margin-top: 2rem; }
.centered-content { text-align: center; }

@media (max-width: 768px) {
    .upload-grid { grid-template-columns: 1fr; }
    .alignment-container { flex-direction: column; }
    .controls-bar { gap: 1rem; }
}