* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    gap: 1px;
    background: rgba(0, 0, 0, 0.1);
}

/* Правая панель */
.settings-panel {
    width: 360px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

    .settings-panel::-webkit-scrollbar {
        width: 6px;
    }

    .settings-panel::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .settings-panel::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

/* Логотип */
.logo {
    padding: 25px 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    line-height: 1.2;
}

    .logo-text span {
        font-size: 14px;
        opacity: 0.9;
    }

/* Секции настроек */
.settings-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.settings-subsection {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.sub-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопки */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    }

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

    .btn-success:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
    }

.btn-download {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    color: white;
    margin-top: 10px;
}

    .btn-download:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(242, 153, 74, 0.4);
    }

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s;
}

    .btn-icon:hover {
        background: #e0e0e0;
        transform: scale(1.05);
    }

.btn-small {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    background: #667eea;
    color: white;
    transition: all 0.2s;
}

    .btn-small:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

.file-name {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    text-align: center;
    word-break: break-all;
}

/* Элементы управления */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

    .zoom-controls input {
        flex: 1;
    }

.zoom-value {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

/* Чекбокс */
.section-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

    .section-checkbox input {
        margin-right: 10px;
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

/* Настройки сетки */
.grid-settings, .custom-settings, .gradient-settings {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s;
}

.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
}

    .setting-row label {
        font-weight: 500;
        color: #555;
        min-width: 80px;
    }

    .setting-row select,
    .setting-row input[type="color"] {
        padding: 4px 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
    }

    .setting-row input[type="range"] {
        flex: 1;
        margin: 0 10px;
        height: 4px;
        -webkit-appearance: none;
        background: linear-gradient(90deg, #667eea, #764ba2);
        border-radius: 2px;
        outline: none;
    }

        .setting-row input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: white;
            border: 2px solid #667eea;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
        }

.color-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.color-item {
    flex: 1;
    text-align: center;
}

    .color-item label {
        display: block;
        font-size: 11px;
        margin-bottom: 5px;
        color: #666;
    }

    .color-item input {
        width: 100%;
        height: 40px;
        border: 2px solid #ddd;
        border-radius: 6px;
        cursor: pointer;
    }

.preset-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

    .preset-select:hover {
        border-color: #667eea;
    }

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

    .preset-buttons button {
        flex: 1;
    }

.actions {
    border-bottom: none;
    padding-bottom: 25px;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

    .history-controls button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Рабочая область */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    position: relative;
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: grab;
    margin: 20px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

    .canvas-container:active {
        cursor: grabbing;
    }

#ditherCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.workspace-info {
    padding: 10px 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    border-radius: 8px;
    margin: 0 20px 20px 20px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .settings-panel {
        width: 320px;
    }

    .color-row {
        flex-direction: column;
    }

    .setting-row {
        flex-wrap: wrap;
    }

        .setting-row input[type="range"] {
            width: 100%;
            margin: 8px 0 0 0;
        }
}
