:root {
    --bg: #121212;
    --accent: #bb86fc;
    --accent-color: #bb86fc;
}
* { box-sizing: border-box; }
body {
    margin: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    display: flex; height: 100vh;
}
.container {
    display: flex; width: 100%; height: 100%;
}
.sidebar {
    --panel: #1e1e1e;
    --text: #e0e0e0;
    --accent-color: #bb86fc;
    --border: #333;
    --input-bg: #2a2a2a;
    --input-border: #444;
    
    width: 320px; background: var(--panel); color: var(--text); padding: 25px;
    display: flex; flex-direction: column; gap: 18px;
    border-right: 1px solid var(--border); overflow-y: auto;
    transition: background 0.3s, color 0.3s;
}
.sidebar.light-theme {
    --panel: #f0f2f5;
    --text: #121212;
    --accent-color: #6200ee;
    --border: #d0d0d0;
    --input-bg: #ffffff;
    --input-border: #bbbbbb;
}
.preview {
    --bg1: #222;
    --bg2: #181818;
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 20px; overflow: hidden;
    background: repeating-conic-gradient(var(--bg1) 0% 25%, var(--bg2) 0% 50%) 50% / 40px 40px;
    position: relative;
    transition: background 0.3s;
}
.preview.light-theme {
    --bg1: #ddd;
    --bg2: #f0f0f0;
}
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #888; text-align: center; cursor: pointer;
    border: 2px dashed #444; border-radius: 12px;
    width: 100%; max-width: 500px; height: 100%; max-height: 400px;
    transition: all 0.2s ease;
    background: rgba(0,0,0,0.2);
}
.preview.light-theme .empty-state {
    background: rgba(255,255,255,0.6);
    border-color: #aaa;
    color: #555;
}
.empty-state:hover, .empty-state.dragover {
    border-color: var(--accent-color); color: var(--accent-color); background: rgba(187, 134, 252, 0.05);
}
canvas {
    max-width: 100%; max-height: 100%; object-fit: contain;
    box-shadow: 0 4px 15px rgba(0,0,0,0.7);
    display: none;
    touch-action: none;
}
.control-group { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 0.9em; font-weight: 600; color: inherit; opacity: 0.8; }
input[type="range"], select, input[type="file"], input[type="text"] { width: 100%; }
input[type="range"] { accent-color: var(--accent-color); cursor: pointer; }
input[type="text"], select { 
    padding: 8px; background: var(--input-bg); color: inherit; 
    border: 1px solid var(--input-border); border-radius: 4px; outline: none;
}
input[type="text"]:focus, select:focus { border-color: var(--accent-color); }
button {
    background: var(--accent-color); color: #000; border: none;
    padding: 12px; font-weight: bold; cursor: pointer; border-radius: 4px;
    transition: opacity 0.2s, transform 0.1s;
}
button:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
button:disabled { background: #444; color: #888; cursor: not-allowed; }
.sidebar.light-theme button { color: #fff; }
.sidebar.light-theme button:disabled { background: #ddd; color: #888; }
#status { font-size: 0.85em; opacity: 0.7; text-align: center; margin-top: auto; }
h2 { margin: 0; font-size: 1.5em; text-align: center; color: var(--accent-color); }

@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
    .preview { min-height: 50vh; }
}

.theme-switch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 30px; flex-shrink: 0; }
.theme-switch input { display: none; }
.theme-switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333; transition: .3s; border-radius: 30px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px; border: 1px solid #555; overflow: hidden;
}
.theme-switch .slider:before {
    position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%; z-index: 2;
}
.theme-switch input:checked + .slider { background-color: var(--accent-color); border-color: var(--accent-color); }
.theme-switch input:checked + .slider:before { transform: translateX(30px); background-color: white; }
.theme-switch .slider svg { width: 14px; height: 14px; z-index: 1; color: #fff; }
.theme-switch input:checked + .slider svg { color: #fff; }


.sidebar.light-theme {
    background: var(--panel);
    color: var(--text);
    border-color: var(--border);
}
.preview.light-theme {
    background: repeating-conic-gradient(var(--bg1) 0% 25%, var(--bg2) 0% 50%) 50% / 40px 40px;
}


.toggle-btn { background: #444; color: #fff; transition: background 0.2s, border 0.2s; border: 1px solid transparent; }
.toggle-btn.active { background: var(--accent-color); color: #000; border-color: var(--accent-color); }
.sidebar.light-theme .toggle-btn { background: #ffffff; color: #333; border: 1px solid #d0d0d0; }
.sidebar.light-theme .toggle-btn.active { background: var(--accent-color); color: #ffffff; border-color: var(--accent-color); }

.section-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}
.sidebar.light-theme .section-card {
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.section-title {
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-card .control-group:last-child {
    margin-bottom: 0;
}

.sidebar.light-theme input[type="range"] {
    background-color: rgba(0, 0, 0, 0.08);
    height: 6px;
    border-radius: 3px;
}
#brushCursor {
    position: fixed;
    pointer-events: none;
    border: 2px solid #fff;
    border-radius: 50%;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 1000;
    box-sizing: border-box;
}
/* theme property test */
