:root {
    --bg-app: #0e0e11; --bg-sidebar: #16161a; --bg-panel: #1f1f24;
    --border: #2a2a30; --text-main: #ededed; --text-muted: #8a8a93;
    --accent: #0a84ff; --accent-hover: #006ee6; --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-app); color: var(--text-main); height: 100vh; overflow: hidden; }
.app-layout { display: flex; height: 100%; }

.sidebar { width: 320px; background-color: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px; gap: 20px; z-index: 10; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.brand-dot { width: 10px; height: 10px; background-color: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
.brand h2 { font-size: 16px; font-weight: 600; }

.panel { background-color: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel-header { font-size: 11px; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }

input[type="file"] { display: none; }
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; background-color: var(--accent); color: white; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: 0.2s; }
.btn-primary:hover:not(:disabled) { background-color: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.tools-grid { display: flex; flex-direction: column; gap: 8px; }
.btn-tool { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background-color: rgba(255, 255, 255, 0.03); color: var(--text-main); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; transition: 0.2s; text-align: left; }
.btn-tool:hover { background-color: rgba(255, 255, 255, 0.08); }
.btn-tool.active { background-color: rgba(10, 132, 255, 0.15); border-color: var(--accent); color: white; }

.settings-content { display: flex; flex-direction: column; gap: 15px; margin-top: 10px; }
.range-group { display: flex; flex-direction: column; gap: 6px; }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: var(--border); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; transition: 0.1s; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.progress-container { display: none; background-color: rgba(0, 0, 0, 0.2); padding: 10px; border-radius: 6px; margin-top: 4px; }
.progress-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.progress-track { width: 100%; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { width: 0%; height: 100%; background: var(--accent); transition: width 0.1s; }

.status-badge { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); padding: 10px; background-color: var(--bg-panel); border-radius: 8px; border: 1px solid var(--border); }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; background-color: #ff9f0a; }
.status-indicator.ready { background-color: #32d74b; }
.status-indicator.busy { background-color: var(--accent); }
.status-indicator.error { background-color: #ff453a; }

.disabled-panel { opacity: 0.4; pointer-events: none; }
.workspace { flex-grow: 1; display: flex; justify-content: center; align-items: center; background-image: radial-gradient(var(--border) 1px, transparent 0); background-size: 20px 20px; padding: 40px; overflow: hidden; }
.canvas-wrapper { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; cursor: grab; }
.canvas-wrapper:active { cursor: grabbing; }
canvas { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); transform-origin: center center; will-change: transform; }

/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .workspace { width: 100%; height: 50vh; padding: 10px; order: 1; }
    .sidebar { width: 100%; height: 50vh; border-right: none; border-top: 1px solid var(--border); padding: 15px; order: 2; }
    .tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    #btnReset, #btnDownload, #btnApplyFilter { grid-column: span 2; margin-top: 5px !important; }
    .btn-tool { font-size: 11px; padding: 8px; flex-direction: column; text-align: center; gap: 5px; }
    .tool-icon { font-size: 18px; }
    .status-badge { position: sticky; bottom: 0; z-index: 100; background-color: var(--bg-panel); }
}